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
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