-
-
Notifications
You must be signed in to change notification settings - Fork 26.2k
Closed
Labels
BugEasyWell-defined and straightforward way to resolveWell-defined and straightforward way to resolve
Description
Description
Error occurs stating that number of features have been changed even if its exactly the same data set.
It only occurs when n_features > n_samples.
Steps/Code to Reproduce
import numpy
from sklearn.decomposition import IncrementalPCA
pca = IncrementalPCA()
pca.partial_fit(numpy.array([[1, 2, 3], [3, 4, 5]]))
pca.partial_fit(numpy.array([[1, 2, 3], [3, 4 ,5]]))
Expected Results
Code should run without errors.
Actual Results
> Traceback (most recent call last):
> File "C:\Program Files\JetBrains\PyCharm 2017.2.2\helpers\pydev\pydevd.py", line 1596, in <module>
> globals = debugger.run(setup['file'], None, None, is_module)
> File "C:\Program Files\JetBrains\PyCharm 2017.2.2\helpers\pydev\pydevd.py", line 1023, in run
> pydev_imports.execfile(file, globals, locals) # execute the script
> File "C:\Program Files\JetBrains\PyCharm 2017.2.2\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
> exec(compile(contents+"\n", file, 'exec'), glob, loc)
> File "$path/main.py", line 130, in <module>
> pca.partial_fit(numpy.array([[1,2,3],[3,4,5]]))
> File "$path\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\decomposition\incremental_pca.py", line 226, in partial_fit
> (self.components_.shape[0], self.n_components_))
> ValueError: Number of input features has changed from 2 to 3 between calls to partial_fit! Try setting n_components to a fixed value.
Versions
Windows-10-10.0.14393-SP0
Python 3.6.2 (v3.6.2:5fd33b5, Jul 8 2017, 04:57:36) [MSC v.1900 64 bit (AMD64)]
NumPy 1.13.1
SciPy 0.19.1
Scikit-Learn 0.19.0
Metadata
Metadata
Assignees
Labels
BugEasyWell-defined and straightforward way to resolveWell-defined and straightforward way to resolve