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

Prepare for n_init=auto in KMeans #6142

Open
wants to merge 14 commits into
base: branch-25.02
Choose a base branch
from

Conversation

betatim
Copy link
Member

@betatim betatim commented Nov 22, 2024

This adds a warning for the upcoming switch from n_init=1 to 'auto'. This adds the possibility to use 'auto', which helps being compatible with sickit-learn.

In which version should we switch to the new default?

This adds a warning for the upcoming switch from n_init=1 to 'auto'.
This adds the possibility to use 'auto', which helps being compatible
with sickit-learn.
@betatim betatim requested a review from a team as a code owner November 22, 2024 14:22
@betatim betatim requested review from cjnolet and wphicks November 22, 2024 14:22
@github-actions github-actions bot added the Cython / Python Cython or Python issue label Nov 22, 2024
@wphicks
Copy link
Contributor

wphicks commented Nov 22, 2024

I'd recommend we switch in 25.04 to get compatibility with the scikit-learn change as soon as possible.

@betatim
Copy link
Member Author

betatim commented Nov 22, 2024

Works for me. There is a PR for a forward merge to 25.02, which makes me think that there won't be a 25.04? Is that right? 25.05 in that case?

Copy link
Member

@dantegd dantegd left a comment

Choose a reason for hiding this comment

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

Just one comment about versions, I think being quick with the change is a good idea as @wphicks suggests.

python/cuml/cuml/cluster/kmeans.pyx Outdated Show resolved Hide resolved
Comment on lines +210 to +212
sklearn_args = inspect.signature(self._cpu_model_class)
sklearn_args = sklearn_args.bind(*args, **kwargs)
sklearn_args.apply_defaults()
Copy link
Member Author

Choose a reason for hiding this comment

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

This means we use the constructor arguments and their default values of the scikit-learn class, combine them with what the user passed in and then feed it to the hyperparameter translator. This makes a difference for cases where the default values in scikit-learn and cuml are different and the user does not explicitly pass that argument.

# The scikit-learn class
class SkTimMeans:
  def __init__(self, foo='bar'):
    ...

# The cuml class
class CuTimMeans:
  def __init__(self, foo='baz'):
    ...

# User code
est = SkTimMeans()

foo should be set to 'bar' in est because that is the default value of the scikit-learn class.

It also fixes the many deprecation warnings in the accelerator tests we were getting for KMeans due to the main change of this PR.

@betatim betatim changed the base branch from branch-24.12 to branch-25.02 December 19, 2024 08:31
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