Closed
Description
Description
Can't use RFE/RFECV on X that is sparse(has NaN values) or y that is 2d.
Both of these decisions should be up to the underlying estimator.
The rejection of sparse X values does not make sense in a world with pipelines.
The reject of 2d output data should be up to the underlying estimator.
Steps/Code to Reproduce
Example partial stack trace from 2d y:
File "/mypythoninstalldir/lib/python3.6/site-packages/sklearn/pipeline.py", line 250, in fit
self._final_estimator.fit(Xt, y, **fit_params)
File "/mypythoninstalldir/lib/python3.6/site-packages/sklearn/feature_selection/rfe.py", line 134, in fit
return self._fit(X, y)
File "/mypythoninstalldir/lib/python3.6/site-packages/sklearn/feature_selection/rfe.py", line 142, in _fit
X, y = check_X_y(X, y, "csc")
File "/mypythoninstalldir/lib/python3.6/site-packages/sklearn/utils/validation.py", line 578, in check_X_y
y = column_or_1d(y, warn=True)
File "/mypythoninstalldir/lib/python3.6/site-packages/sklearn/utils/validation.py", line 614, in column_or_1d
raise ValueError("bad input shape {0}".format(shape))
ValueError: bad input shape (256, 2)
Expected Results
No error is thrown.