movie covers return shape error
NinjaAtWork opened this issue · 4 comments
this line :
img = (scaler.inverse_transform(img)).astype(int)
at here :
https://github.com/JustGlowing/minisom/blob/master/examples/MovieCovers.ipynb
return shape error
can you fix it?
Great , here you are :
ValueError Traceback (most recent call last)
Untitled-1.ipynb Cell 1' in <cell line: 51>()
54 img = win_map[position][0]
55 collided += win_map[position][1:]
---> 56 place_image(i, img)
57 else:
58 to_fill.append(i)
Untitled-1.ipynb Cell 1' in place_image(i, img)
43 def place_image(i, img):
---> 44 img = (scaler.inverse_transform(img)).astype(int)
45 grid[i].imshow(img.reshape(original_shape))
46 grid[i].axis('off')
File c:\ProgramData\Anaconda3\envs\General\lib\site-packages\sklearn\preprocessing_data.py:1016, in StandardScaler.inverse_transform(self, X, copy)
1013 check_is_fitted(self)
1015 copy = copy if copy is not None else self.copy
-> 1016 X = check_array(
1017 X,
1018 accept_sparse="csr",
1019 copy=copy,
1020 estimator=self,
1021 dtype=FLOAT_DTYPES,
1022 force_all_finite="allow-nan",
1023 )
1025 if sparse.issparse(X):
1026 if self.with_mean:
File c:\ProgramData\Anaconda3\envs\General\lib\site-packages\sklearn\utils\validation.py:769, in check_array(array, accept_sparse, accept_large_sparse, dtype, order, copy, force_all_finite, ensure_2d, allow_nd, ensure_min_samples, ensure_min_features, estimator)
767 # If input is 1D raise error
768 if array.ndim == 1:
--> 769 raise ValueError(
770 "Expected 2D array, got 1D array instead:\narray={}.\n"
771 "Reshape your data either using array.reshape(-1, 1) if "
772 "your data has a single feature or array.reshape(1, -1) "
773 "if it contains a single sample.".format(array)
774 )
776 # make sure we actually converted to numeric:
777 if dtype_numeric and array.dtype.kind in "OUSV":
ValueError: Expected 2D array, got 1D array instead:
array=[0. 0. 0. ... 0. 0. 0.].
Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.
python : 3.9.12
numpy : 1.22.3
Sorted with the last commit.
Great ! thanks for update :)