From 6d7fde3f98a77fbc448510e3c7af9b2ad2aedce6 Mon Sep 17 00:00:00 2001 From: gaborberei Date: Mon, 7 Mar 2022 11:59:03 +0100 Subject: [PATCH 1/2] formating documentation --- examples/cluster/plot_mean_shift.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/examples/cluster/plot_mean_shift.py b/examples/cluster/plot_mean_shift.py index ae6d46a68dac1..8caa604bc44c9 100644 --- a/examples/cluster/plot_mean_shift.py +++ b/examples/cluster/plot_mean_shift.py @@ -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) @@ -36,8 +38,9 @@ print("number of estimated clusters : %d" % n_clusters_) -# ############################################################################# +# %% # Plot result +# -------------------------- import matplotlib.pyplot as plt from itertools import cycle From cb6340d626cc9760167d86dab41114272cf7edfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Est=C3=A8ve?= Date: Wed, 9 Mar 2022 11:22:58 +0100 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Guillaume Lemaitre --- examples/cluster/plot_mean_shift.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/cluster/plot_mean_shift.py b/examples/cluster/plot_mean_shift.py index 8caa604bc44c9..6a6827e5aa49d 100644 --- a/examples/cluster/plot_mean_shift.py +++ b/examples/cluster/plot_mean_shift.py @@ -17,13 +17,13 @@ # %% # 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) @@ -40,7 +40,7 @@ # %% # Plot result -# -------------------------- +# ----------- import matplotlib.pyplot as plt from itertools import cycle