Skip to content

Commit

Permalink
1.3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
erdogant committed Dec 8, 2021
1 parent 173f359 commit d36d770
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 38 deletions.
2 changes: 1 addition & 1 deletion clustimage/clustimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
37 changes: 0 additions & 37 deletions clustimage/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d36d770

Please sign in to comment.