Skip to content

FIX warn if an estimator does have a concrete __sklearn_tags__ implementation#30516

Merged
jeremiedbb merged 13 commits into
scikit-learn:mainfrom
glemaitre:is/30479_bis
Jan 6, 2025
Merged

FIX warn if an estimator does have a concrete __sklearn_tags__ implementation#30516
jeremiedbb merged 13 commits into
scikit-learn:mainfrom
glemaitre:is/30479_bis

Conversation

@glemaitre

Copy link
Copy Markdown
Member

closes #30479

Catch the error in the case that there is no __sklearn_tags__ implementation in the MRO. We return the default tags and request to inherit from BaseEstimator that implements it.

@github-actions

github-actions Bot commented Dec 20, 2024

Copy link
Copy Markdown

✔️ Linting Passed

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

Generated for commit: 1e0a0a6. Link to the linter CI: here

Comment thread doc/whats_new/upcoming_changes/sklearn.utils/30516.fix.rst Outdated
Comment thread sklearn/utils/_tags.py Outdated
Comment thread sklearn/utils/_tags.py Outdated

@LiorxCohen LiorxCohen left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didnt understand how did you fix that bug

@jeremiedbb jeremiedbb added this to the 1.6.1 milestone Jan 2, 2025
Comment thread sklearn/utils/_tags.py
glemaitre and others added 5 commits January 3, 2025 10:41
Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com>
Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com>
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
Comment thread sklearn/utils/_tags.py Outdated

@adrinjalali adrinjalali left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Comment thread doc/whats_new/upcoming_changes/sklearn.utils/30516.fix.rst Outdated
Comment thread doc/whats_new/upcoming_changes/sklearn.utils/30516.fix.rst Outdated
Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com>
Comment thread doc/whats_new/upcoming_changes/sklearn.utils/30516.fix.rst Outdated
Co-authored-by: Jérémie du Boisberranger <jeremie@probabl.ai>
@jeremiedbb

Copy link
Copy Markdown
Member

So we intend to always raise and require inheriting from BaseEstimator in 1.7 ? Let's mention the version in the warning message and add a comment to remind us to clean up in 1.7

@glemaitre

Copy link
Copy Markdown
Member Author

So we intend to always raise and require inheriting from BaseEstimator in 1.7 ?

Not really, you could just implement __sklearn_tags__ and the super will be working.

@glemaitre

Copy link
Copy Markdown
Member Author

I modify the warning slightly to add the version for erroring and discourage defining __sklearn_tags__

Comment thread sklearn/utils/_tags.py
Co-authored-by: Jérémie du Boisberranger <jeremie@probabl.ai>
@jeremiedbb jeremiedbb merged commit bf52a0a into scikit-learn:main Jan 6, 2025
@clindhorst2

clindhorst2 commented Jan 6, 2025

Copy link
Copy Markdown

When will this be updated in the library on Google Colab? I just ran into this issue when I was trying to use it with the skorch library. I am unfamiliar with the timeline these fixes are corrected.

jeremiedbb added a commit to jeremiedbb/scikit-learn that referenced this pull request Jan 8, 2025
…entation (scikit-learn#30516)

Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com>
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
Co-authored-by: Jérémie du Boisberranger <jeremie@probabl.ai>
jeremiedbb added a commit to jeremiedbb/scikit-learn that referenced this pull request Jan 8, 2025
…entation (scikit-learn#30516)

Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com>
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
Co-authored-by: Jérémie du Boisberranger <jeremie@probabl.ai>
jeremiedbb added a commit that referenced this pull request Jan 9, 2025
…entation (#30516)

Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com>
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
Co-authored-by: Jérémie du Boisberranger <jeremie@probabl.ai>
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.

Version 1.6.X: ClassifierMixIn failing with new __sklearn_tags__ function

6 participants