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

Make sure the proxied classes use the same __name__ #6305

Closed
wants to merge 1 commit into from

Conversation

betatim
Copy link
Member

@betatim betatim commented Feb 10, 2025

The name of a class is used to automatically derive names that need to match between accelerator and not accelerator. For example in a Pipeline:

pipeline = make_pipeline(PCA(), LogisticRegression())

# Get the PCA instance
pipeline.named_steps["pca"]

The __name__ of a class is used to automatically derive names that need
to match between accelerator and not accelerator.
@betatim betatim requested a review from a team as a code owner February 10, 2025 13:05
@betatim betatim requested review from cjnolet and divyegala February 10, 2025 13:05
@github-actions github-actions bot added the Cython / Python Cython or Python issue label Feb 10, 2025
rapids-bot bot pushed a commit that referenced this pull request Feb 10, 2025
This makes the proxy look and feel more like the original class.

This copies several attributes, not just `__name__` and makes sure the signature of the constructor looks like that of the scikit-learn class. This is useful for people who inspect it during coding (like some editors) or `ipython`'s `LogisticRegression?`.

~~For some reason the test in `test_basic_estimator.py` fails because the proxy doesn't have a `__name__` attribute. Trying to work out why, if someone can spot the mistake let me know~~

This is an alternative/extended version of #6305

Authors:
  - Tim Head (https://github.com/betatim)

Approvers:
  - Simon Adorf (https://github.com/csadorf)

URL: #6306
@betatim
Copy link
Member Author

betatim commented Feb 11, 2025

#6306 merged instead

@betatim betatim closed this Feb 11, 2025
@betatim betatim deleted the automatic-step-naming branch February 11, 2025 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cython / Python Cython or Python issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant