[go: up one dir, main page]

Skip to content
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

MNT SLEP6: raise NotImplementedError for meta-estimators not supporting metadata routing #27389

Merged
merged 18 commits into from
Sep 25, 2023

Conversation

adrinjalali
Copy link
Member

This PR makes all meta-estimators for which we haven't implemented metadata routing yet to raise a NotImplementedError if they're used in other meta-estimators (via raising this in get_metadata_routing).

It also makes them raise in fit if metadata routing is enabled and any metadata is passed to them.

cc @glemaitre @OmarManzoor

@github-actions
Copy link
github-actions bot commented Sep 16, 2023

✔️ Linting Passed

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

Generated for commit: 3e31dc8. Link to the linter CI: here

@adrinjalali
Copy link
Member Author

CI is green now.

@glemaitre glemaitre self-requested a review September 18, 2023 08:06
@adrinjalali
Copy link
Member Author

This is ready for review now @glemaitre

@adrinjalali adrinjalali added this to the 1.4 milestone Sep 25, 2023
Copy link
Member
@glemaitre glemaitre left a comment

Choose a reason for hiding this comment

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

Only a nitpick. Otherwise LGTM.

)


class _RoutingNotSupported:
Copy link
Member

Choose a reason for hiding this comment

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

To be in line with other patter in the library.

Suggested change
class _RoutingNotSupported:
class _RoutingNotSupportedMixin:

def _raise_for_unsupported_routing(obj, method, **kwargs):
"""Raise when metadata routing is enabled and metadata is passed.

This is used in meta-estimators which have not implemented metadata routing
Copy link
Member

Choose a reason for hiding this comment

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

I think that we could make it explicit that this is to be used in the desired function when metadata are already passed (e.g. sample_weight)

Copy link
Member Author

Choose a reason for hiding this comment

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

added a comment

Copy link
Member
@glemaitre glemaitre left a comment

Choose a reason for hiding this comment

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

Only a nitpick. Otherwise LGTM.

Copy link
Contributor
@OmarManzoor OmarManzoor left a comment

Choose a reason for hiding this comment

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

LGTM Thanks @adrinjalali

doc/whats_new/v1.4.rst Outdated Show resolved Hide resolved
Co-authored-by: Omar Salman <omar.salman@arbisoft.com>
@OmarManzoor OmarManzoor enabled auto-merge (squash) September 25, 2023 13:29
@OmarManzoor OmarManzoor merged commit 59d5236 into scikit-learn:main Sep 25, 2023
25 checks passed
@adrinjalali adrinjalali deleted the slep6/notimplemented branch September 25, 2023 13:53
lesteve pushed a commit to lesteve/scikit-learn that referenced this pull request Sep 28, 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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants