-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Loosened to dist <= stop_thresh
to converge in on 1D constant data
#28951
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
Loosened to dist <= stop_thresh
to converge in on 1D constant data
#28951
Conversation
Thanks for the PR @akikuno. Please add a non regression test in |
# Test convergence using 2D constant data | ||
x = np.concatenate([np.zeros((10, 10)), np.ones((10, 10))]) | ||
n_iter = MeanShift().fit(x).n_iter_ | ||
assert n_iter < 300 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove the 2d case. The 1d case is enough as non-regression test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ogrisel
Thank you so much for all your guidance! I have learnt a lot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to remove the 2d case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akikuno This comment has not been addressed yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ogrisel
Sorry, I mistakenly thought it had already been changed.
I have now removed the 2d case.
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
doc/whats_new/v1.5.rst
Outdated
- |Efficiency| The `clustering.MeanShift` class has now improved computational speed as it properly converges for constant data. | ||
:pr:`28951` by :user:`Akihiro Kuno <akikuno>`. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would consider it a bug and move that in the cluster
section of the changelog.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jeremiedbb
Thanks for your updates! I have moved the log to the sklearn.cluster
section.
Co-authored-by: Jérémie du Boisberranger <jeremie@probabl.ai>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. thanks @akikuno
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org> Co-authored-by: Jérémie du Boisberranger <jeremie@probabl.ai>
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org> Co-authored-by: Jérémie du Boisberranger <jeremie@probabl.ai>
Reference Issues/PRs
Discussed #28926
What does this implement/fix? Explain your changes.
As @ogrisel suggested, I implemented the condition
dist <= stop_thresh
in the_mean_shift_single_seed
function to address the issue ofMeanShift
failing to converge on 1D constant data within 300 iterations.Any other comments?