ValueError: Expected 2D array, got 1D array instead
cgreenberg opened this issue · 1 comments
cgreenberg commented
Using continuous variables. Took a simple input matrix X and target variable y. It seems to run in a problem using sklearn's preprocessing even though the matrix dimensions are correctly set:
File "run.py", line 29, in <module>
feat_selector.fit(X, y)
File "/home/charles/corex/lib/python2.7/site-packages/mifs-0.0.1.dev0-py2.7.egg/mifs/mifs.py", line 149, in fit
return self._fit(X, y)
File "/home/charles/corex/lib/python2.7/site-packages/mifs-0.0.1.dev0-py2.7.egg/mifs/mifs.py", line 193, in _fit
self.X, y = self._check_params(X, y)
File "/home/charles/corex/lib/python2.7/site-packages/mifs-0.0.1.dev0-py2.7.egg/mifs/mifs.py", line 296, in _check_params
y = ss.fit_transform(y)
File "/home/charles/corex/lib/python2.7/site-packages/sklearn/base.py", line 518, in fit_transform
return self.fit(X, **fit_params).transform(X)
File "/home/charles/corex/lib/python2.7/site-packages/sklearn/preprocessing/data.py", line 590, in fit
return self.partial_fit(X, y)
File "/home/charles/corex/lib/python2.7/site-packages/sklearn/preprocessing/data.py", line 612, in partial_fit
warn_on_dtype=True, estimator=self, dtype=FLOAT_DTYPES)
File "/home/charles/corex/lib/python2.7/site-packages/sklearn/utils/validation.py", line 410, in check_array
"if it contains a single sample.".format(array))
ValueError: Expected 2D array, got 1D array instead:
array=[ 1. 1. 1. ..., 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.```
danielhomola commented
Can you please try the latest version of the code and report back if you still encounter the bug? Thanks!