-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
MNT Checking function _estimator_has
also raises AttributeError
#28167
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
Conversation
The failure is not associated with this PR. I open #28168 trying to solve the issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In terms of source code, it looks good. We need to add non-regression case for each case or if the test already exist, we need to match the class name to be sure that we have the proper error message.
I gave an example for the stacking case.
I just realized that I commented in the issue and not the PR. @StefanieSenger you can have a look at the following comment regarding the unit tests: #28108 (comment) |
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
I've updated the tests as we have talked about, @glemaitre. They all pass now. But there are new issues popping up in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will need to have an entry in the changelog since we fix the error message.
Uhm I don't see the error with the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise LGTM. Thanks @StefanieSenger
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
I've made those little requested changes, @glemaitre. Thanks for reviewing and suggesting. This is it for this PR. On the unrelated test failure: Locally, when I run I also get this on my main branch, but not a branch where I had last pulled 4 weeks ago . My compilers are up to date with I think it's connected to #27546 and somehow the re-build didn't work out for me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nits, otherwise LGTM.
X, y = load_breast_cancer(return_X_y=True) | ||
X_train, X_test, y_train, _ = train_test_split( | ||
scale(X), y, stratify=y, random_state=42 | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can probably use a smaller dataset, and avoid calling scale
to make the test faster.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The scale would avoid a ConvergenceWarning
of the LogisticRegression
certainly. To be checked if we remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can do make_classification
instead then. Would be faster. The data doesn't matter here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I now put make_classifiction
for data creation.
@StefanieSenger Indeed, the error look like the type in the Cython file changed. So a good |
Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com>
@glemaitre |
…cikit-learn#28167) Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com> Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com>
…28167) Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com> Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com>
Reference Issues/PRs
Towards #28108
What does this implement/fix? Explain your changes.
This PR aims to display a more understandable error message in the case when sub-estimators don't implement a method, the meta-estimator that they are being used in DOES implement. See the issue for an example.
AttributeError
to be raised duringavailable_if
, to prevent the too generic error message from_AvailableIfDescriptor
from being raisedOneVsRestClassifier
, nothing was to be found