Skip to content

FIX handle outlier detector in _get_response_values #27565

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

Merged
merged 2 commits into from
Oct 13, 2023

Conversation

glemaitre
Copy link
Member

@glemaitre glemaitre commented Oct 11, 2023

When merging #27291, I broke main because we use DecisionBoundaryDisplay with outlier detector but only in the documentation.

This PR addresses this regression and add 2 new tests where we use outlier detector in the tests of DecisionBoundaryDisplay and _get_response_values. I don't need any entry in the changelog since this is a regression just in main.

Here is the traceback on main:

Extension error:
Here is a summary of the problems encountered when running the examples

Unexpected failing examples:
/home/circleci/project/examples/ensemble/plot_isolation_forest.py failed leaving traceback:
Traceback (most recent call last):
  File "/home/circleci/project/examples/ensemble/plot_isolation_forest.py", line 112, in <module>
    disp = DecisionBoundaryDisplay.from_estimator(
  File "/home/circleci/project/sklearn/inspection/_plot/decision_boundary.py", line 359, in from_estimator
    response, _, response_method_used = _get_response_values(
  File "/home/circleci/project/sklearn/utils/_response.py", line 225, in _get_response_values
    raise ValueError(
ValueError: IsolationForest should either be a classifier to be used with response_method=decision_function or the response_method should be 'predict'. Got a regressor with response_method=decision_function instead.


/home/circleci/project/examples/svm/plot_oneclass.py failed leaving traceback:
Traceback (most recent call last):
  File "/home/circleci/project/examples/svm/plot_oneclass.py", line 50, in <module>
    DecisionBoundaryDisplay.from_estimator(
  File "/home/circleci/project/sklearn/inspection/_plot/decision_boundary.py", line 359, in from_estimator
    response, _, response_method_used = _get_response_values(
  File "/home/circleci/project/sklearn/utils/_response.py", line 225, in _get_response_values
    raise ValueError(
ValueError: OneClassSVM should either be a classifier to be used with response_method=decision_function or the response_method should be 'predict'. Got a regressor with response_method=decision_function instead.


/home/circleci/project/examples/linear_model/plot_sgdocsvm_vs_ocsvm.py failed leaving traceback:
Traceback (most recent call last):
  File "/home/circleci/project/examples/linear_model/plot_sgdocsvm_vs_ocsvm.py", line 85, in <module>
    DecisionBoundaryDisplay.from_estimator(
  File "/home/circleci/project/sklearn/inspection/_plot/decision_boundary.py", line 359, in from_estimator
    response, _, response_method_used = _get_response_values(
  File "/home/circleci/project/sklearn/utils/_response.py", line 225, in _get_response_values
    raise ValueError(
ValueError: OneClassSVM should either be a classifier to be used with response_method=decision_function or the response_method should be 'predict'. Got a regressor with response_method=decision_function instead.


/home/circleci/project/examples/applications/plot_outlier_detection_wine.py failed leaving traceback:
Traceback (most recent call last):
  File "/home/circleci/project/examples/applications/plot_outlier_detection_wine.py", line 66, in <module>
    DecisionBoundaryDisplay.from_estimator(
  File "/home/circleci/project/sklearn/inspection/_plot/decision_boundary.py", line 359, in from_estimator
    response, _, response_method_used = _get_response_values(
  File "/home/circleci/project/sklearn/utils/_response.py", line 225, in _get_response_values
    raise ValueError(
ValueError: EllipticEnvelope should either be a classifier to be used with response_method=decision_function or the response_method should be 'predict'. Got a regressor with response_method=decision_function instead.

@github-actions
Copy link

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: 0feeacc. Link to the linter CI: here

@glemaitre
Copy link
Member Author

ping @adrinjalali @ogrisel @adrinjalali @jeremiedbb to resolve quickly the issue. Sorry about this one.

@lesteve
Copy link
Member

lesteve commented Oct 13, 2023

Merging, thanks!

@lesteve lesteve merged commit 8912619 into scikit-learn:main Oct 13, 2023
glemaitre added a commit to glemaitre/scikit-learn that referenced this pull request Oct 31, 2023
REDVM pushed a commit to REDVM/scikit-learn that referenced this pull request Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants