From d36d770d1d125a6e49ba0e119fadfa24e18b04e5 Mon Sep 17 00:00:00 2001 From: erdogant Date: Wed, 8 Dec 2021 22:33:43 +0100 Subject: [PATCH] 1.3.6 --- clustimage/clustimage.py | 2 +- clustimage/examples.py | 37 ------------------------------------- 2 files changed, 1 insertion(+), 38 deletions(-) diff --git a/clustimage/clustimage.py b/clustimage/clustimage.py index d2a6af0..a43c714 100644 --- a/clustimage/clustimage.py +++ b/clustimage/clustimage.py @@ -1901,7 +1901,7 @@ def store_to_disk(Xraw, dim, tempdir): pathname = os.path.join(tempdir, filename) # Write to disk img = imscale(Xraw[i,:].reshape(dim)) - cv2.imwrite(pathname, Xraw[i,:].reshape(dim)) + cv2.imwrite(pathname, img) filenames.append(filename) pathnames.append(pathname) return pathnames, filenames diff --git a/clustimage/examples.py b/clustimage/examples.py index 5ea6abf..b0659c5 100644 --- a/clustimage/examples.py +++ b/clustimage/examples.py @@ -5,43 +5,6 @@ # # Read image according the preprocessing steps -# %% -from clustimage import Clustimage - -# init with PCA method -cl = Clustimage(method='pca', - embedding='tsne', - grayscale=False, - dim=(128,128), - params_pca={'n_components':0.95}, - store_to_disk=False) - -# Load MNIST example data -X = cl.import_example(data='mnist') - -# There are 1797 digits in total, each with 64 features which is the flattened 8x8 grayscale image. -# print(X.shape) -# (1797, 64) - -# print(X) -# array([[ 0., 0., 5., ..., 0., 0., 0.], -# [ 0., 0., 0., ..., 10., 0., 0.], -# [ 0., 0., 0., ..., 16., 9., 0.], -# ..., -# [ 0., 0., 1., ..., 6., 0., 0.], -# [ 0., 0., 2., ..., 12., 0., 0.], -# [ 0., 0., 10., ..., 12., 1., 0.]]) - -# Preprocessing, feature extraction, embedding and cluster evaluation -results = cl.fit_transform(X, - cluster='agglomerative', - evaluate='silhouette', - metric='euclidean', - linkage='ward', - min_clust=3, - max_clust=25, - cluster_space='high') - # %% HASHES import matplotlib.pyplot as plt from clustimage import Clustimage