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

Improve infrastructure for experimental dispatching of non existing methods in cuML #6148

Draft
wants to merge 3 commits into
base: branch-24.12
Choose a base branch
from

Conversation

dantegd
Copy link
Member

@dantegd dantegd commented Nov 27, 2024

This PR adds methods in UniversalBase, so that cuML estimators that inherit from it can enable better errors, and experimentally dispatch to other libraries (sklearn, umap, hdbscan...) for methods that haven't been implemented in cuML itself.

@github-actions github-actions bot added the Cython / Python Cython or Python issue label Nov 27, 2024
@@ -792,3 +792,25 @@ class UniversalBase(Base):
"""

return False

def _check_cpu_model(self):
Copy link
Member

Choose a reason for hiding this comment

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

Can we delete this method from ProxyEstimator now that it is implemented here?

@betatim
Copy link
Member

betatim commented Nov 27, 2024

I think the only bigger picture question for this PR is: should we just implement the missing methods instead of forwarding? It would probably benefit all cuml users, be more straightforward (measure in less dunder usage :D), but it is a lot more work.

We can decide in either direction, but wanted to bring it up so that we briefly talk about it and then decide.

Copy link
Contributor

@viclafargue viclafargue left a comment

Choose a reason for hiding this comment

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

LGTM, I think that the dispatching mechanism should work well :). However, what worries me a bit is that it is not a guarantee that Scikit-Learn functions will all work fine just following attributes transfers. There seems to be a lot of edge cases, and I believe that this would require some more rigorous testing. Ideally, if we want to guarantee functionality we would have to whitelist the functions that work fine for each estimator.

and creates one if necessary.
"""
if not hasattr(self, "_cpu_model"):
self.import_cpu_model()
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that the call to the import_cpu_model function is not necessary here as we already checked the presence of the _cpu_model_class attribute earlier.

@betatim
Copy link
Member

betatim commented Nov 27, 2024

Maybe something to add is a test that iterates overall cuml estimators and their scikit-learn equivalent and checks all attrs exist. We could extend it to instantiate each estimator, fit it and then repeat the check.

@betatim
Copy link
Member

betatim commented Nov 28, 2024

For the "iterate over all estimators" part: I wrote something to do that for #6107 and am wanting to re-use it for #4753 (iterate all estimators, then filter those that accept random_state=). Should we make a separate PR that adds this functionality that we can merge before all of these and this PR?

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.

3 participants