Skip to content

Conversation

@amueller
Copy link
Member

Fixes #2356. (see discussion there)
This will still crash for some variant of the reported example, like this:

import numpy as np
from sklearn.cluster import MeanShift, estimate_bandwidth
from sklearn.datasets.samples_generator import make_blobs


# Generate sample data
centers = [
    np.ones(200),
    -np.ones(200),
]
X, _ = make_blobs(n_samples=100, centers=centers, cluster_std=0.3, random_state=0)

ms = MeanShift(bin_seeding=True)

ms.fit(X)

but it will tell you that " No point was within bandwidth of any seed. Try a different seeding strategy."
Trying to put a grid on a 200d space is just not a good idea.

@amueller amueller added this to the 0.16 milestone Jan 28, 2015
@agramfort
Copy link
Member

LGTM

@amueller amueller force-pushed the mean_shift_no_centers branch from 02fbb51 to d5c6c8d Compare January 28, 2015 21:58
@amueller amueller changed the title Better error messages in MeanShift, slightly more robust to bad binning. [MRG + 1] Better error messages in MeanShift, slightly more robust to bad binning. Jan 28, 2015
Copy link
Member

Choose a reason for hiding this comment

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

Can you please recall the actual value of the bandwidth parameter in this error message?

@ogrisel ogrisel added the Bug label Feb 7, 2015
@ogrisel
Copy link
Member

ogrisel commented Feb 7, 2015

Aside from the minor comments, +1 on my side as well.

@amueller amueller force-pushed the mean_shift_no_centers branch from d5c6c8d to a9b3965 Compare February 7, 2015 11:59
@amueller
Copy link
Member Author

amueller commented Feb 7, 2015

Addressed the comments, merging. Thanks for the reviews :)

amueller added a commit that referenced this pull request Feb 7, 2015
[MRG + 1] Better error messages in MeanShift, slightly more robust to bad binning.
@amueller amueller merged commit 4629366 into scikit-learn:master Feb 7, 2015
@amueller amueller deleted the mean_shift_no_centers branch February 7, 2015 12:26
@ogrisel
Copy link
Member

ogrisel commented Feb 7, 2015

🍻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug in MeanShift with small number of samples

3 participants