You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DOC error message when checking response values of an estimator not clear #33093
Current function that checks response values of an estimator
assumes that if the estimator is not a classifier or an outlier detector, then it is a regressor.
In the latter case, if it doesn't find the predict function,
it raises an error stating that the estimator is a regressor: ValueError: ... Got a regressor....
However, the estimator might be something other than a regressor.
For example, it can be a classification Pipeline with a MRO issue, see NeuroTechX/moabb#815
Many other GitHub repositories have reported this ambiguous error, see list in #33084 (comment)
The goal of this issue is to discuss how to correct the message by making it clearer,
specifically by no longer stating that it is a regressor.
Suggest a potential alternative/fix
Current function _get_response_values.py in scikit-learn/sklearn/utils/_response.py
else: # estimator is a regressorifresponse_method!="predict":
raiseValueError(
f"{estimator.__class__.__name__} should either be a classifier to be "f"used with response_method={response_method} or the response_method ""should be 'predict'. Got a regressor with response_method="f"{response_method} instead."
)
prediction_method=estimator.predicty_pred, pos_label=prediction_method(X), None
could be corrected into
elifis_regressor(estimator):
prediction_method=estimator.predicty_pred, pos_label=prediction_method(X), Noneelse:
raiseValueError(
f"{estimator.__class__.__name__} is not recognized as a classifier, ""an outlier detector or a regressor."
)
Hi @SSVP-debug, thank you for your interest, but please check Issues tagged “Needs Triage”. Note also that @qbarthelemy might be interested in working on this himself once consensus has been reached on how to handle this issue.
to the top of the function, because this will check if the requested method is available for all types of estimators and raise a comprehensive AttributeError if it is not implemented.
(This should be backed up by corresponding tests, though.)
Then the elif for outlier detectors can be removed and the else can be reduced to
Note to myself:
This would also already be a step towards #33015 (comment), and might also reduce the need for treating regressors separately when resolving "auto" here, as the list would be reduced to predict
by _get_response_values
I would indeed be in favor of first trying what @AnneBeyer suggests to check if it works as anticipated. @qbarthelemy@AnneBeyer any of you interested in opening a PR?
Activity
SSVP-debug commentedon Jan 16, 2026
Hello @qbarthelemy , I’m a first-time contributor. May I work on this issue?
AnneBeyer commentedon Jan 16, 2026
Hi @SSVP-debug, thank you for your interest, but please check Issues tagged “Needs Triage”. Note also that @qbarthelemy might be interested in working on this himself once consensus has been reached on how to handle this issue.
AnneBeyer commentedon Jan 16, 2026
Thank you for raising this again as an issue @qbarthelemy.
From what I understand, there is no reason why
My suggestion would be to move
scikit-learn/sklearn/utils/_response.py
Line 203 in b764229
to the top of the function, because this will check if the requested method is available for all types of estimators and raise a comprehensive
AttributeErrorif it is not implemented.(This should be backed up by corresponding tests, though.)
Then the
eliffor outlier detectors can be removed and theelsecan be reduced toscikit-learn/sklearn/utils/_response.py
Line 244 in b764229
to cover all other cases (outlier detectors, regressors and clusterers).
Could any of you please double-check if I missed anything, @glemaitre @jeremiedbb @thomasjpfan @ogrisel?
Note to myself:
This would also already be a step towards #33015 (comment), and might also reduce the need for treating regressors separately when resolving "auto" here, as the list would be reduced to
predictby
_get_response_valuesscikit-learn/sklearn/inspection/_plot/decision_boundary.py
Lines 45 to 49 in b764229
thomasjpfan commentedon Jan 18, 2026
@AnneBeyer At a glance your analysis looks correct to me and should simplify
_get_response_values.ogrisel commentedon Jan 23, 2026
I would indeed be in favor of first trying what @AnneBeyer suggests to check if it works as anticipated. @qbarthelemy @AnneBeyer any of you interested in opening a PR?
qbarthelemy commentedon Jan 23, 2026
I opened a PR here #33126
AdoDeBrilliance commentedon Feb 2, 2026
Hi team 👋
I'm a student contributor and would like to improve the documentation for this issue.
May I work on this?
Thanks!
Human gold patch for scikit-learn__scikit-learn-33126