Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expected 2D array, got 1D array instead: array=[]. #10

Closed
leenaraz opened this issue Mar 21, 2019 · 2 comments
Closed

Expected 2D array, got 1D array instead: array=[]. #10

leenaraz opened this issue Mar 21, 2019 · 2 comments

Comments

@leenaraz
Copy link

when running
fps = ic.pca(fps, n_components=0.95)
i get the following error

**Traceback (most recent call last):
File "", line 1, in
File "/home/leena/mainproject/imagecluster/imagecluster/calc.py", line 185, in pca
Xp = PCA(kwds).fit(X).transform(X)
File "/usr/lib/python3/dist-packages/sklearn/decomposition/pca.py", line 329, in fit
self._fit(X)
File "/usr/lib/python3/dist-packages/sklearn/decomposition/pca.py", line 370, in _fit
copy=self.copy)
File "/usr/lib/python3/dist-packages/sklearn/utils/validation.py", line 441, in check_array
"if it contains a single sample.".format(array))
ValueError: Expected 2D array, got 1D array instead:
array=[].
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.

@elcorto
Copy link
Owner

elcorto commented Mar 22, 2019

What verions of the packages in requirements.txt do you use?

@leenaraz
Copy link
Author

I found the solution. It was my bad the images were saves in a sub folder in pics. i copied it and the issue was solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants