8000 DOC: use notebook-style for plot_mean_shift.py by gaborberei · Pull Request #22713 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

DOC: use notebook-style for plot_mean_shift.py #22713

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

Merged
merged 2 commits into from
Mar 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions examples/cluster/plot_mean_shift.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@
from sklearn.cluster import MeanShift, estimate_bandwidth
from sklearn.datasets import make_blobs

# #############################################################################
# %%
# Generate sample data
# --------------------
centers = [[1, 1], [-1, -1], [1, -1]]
X, _ = make_blobs(n_samples=10000, centers=centers, cluster_std=0.6)

# #############################################################################
# %%
# Compute clustering with MeanShift
# ---------------------------------

# The following bandwidth can be automatically detected using
bandwidth = estimate_bandwidth(X, quantile=0.2, n_samples=500)
Expand All @@ -36,8 +38,9 @@

print("number of estimated clusters : %d" % n_clusters_)

# #############################################################################
# %%
# Plot result
# -----------
import matplotlib.pyplot as plt
from itertools import cycle

Expand Down
0