Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Unnecessary call to check_X_y in RFE #10821

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

Closed
jimmywan opened this issue Mar 16, 2018 · 1 comment · Fixed by #11635
Closed

Unnecessary call to check_X_y in RFE #10821

jimmywan opened this issue Mar 16, 2018 · 1 comment · Fixed by #11635
Labels

Comments

@jimmywan
Copy link
Contributor

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.

@jimmywan
Copy link
Contributor Author

Attached PR.

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