diff --git a/sklearn/cluster/_affinity_propagation.py b/sklearn/cluster/_affinity_propagation.py index e5cb501984762..f38488b39a46f 100644 --- a/sklearn/cluster/_affinity_propagation.py +++ b/sklearn/cluster/_affinity_propagation.py @@ -398,9 +398,6 @@ class AffinityPropagation(ClusterMixin, BaseEstimator): Notes ----- - For an example usage, - see :ref:`sphx_glr_auto_examples_cluster_plot_affinity_propagation.py`. - The algorithmic complexity of affinity propagation is quadratic in the number of points. @@ -442,6 +439,12 @@ class AffinityPropagation(ClusterMixin, BaseEstimator): >>> clustering.cluster_centers_ array([[1, 2], [4, 2]]) + + For an example usage, + see :ref:`sphx_glr_auto_examples_cluster_plot_affinity_propagation.py`. + + For a comparison of Affinity Propagation with other clustering algorithms, see + :ref:`sphx_glr_auto_examples_cluster_plot_cluster_comparison.py` """ _parameter_constraints: dict = { diff --git a/sklearn/cluster/_agglomerative.py b/sklearn/cluster/_agglomerative.py index 2fa7253e665b8..a9be3b183c37a 100644 --- a/sklearn/cluster/_agglomerative.py +++ b/sklearn/cluster/_agglomerative.py @@ -925,6 +925,9 @@ class AgglomerativeClustering(ClusterMixin, BaseEstimator): AgglomerativeClustering() >>> clustering.labels_ array([1, 1, 1, 0, 0, 0]) + + For a comparison of Agglomerative clustering with other clustering algorithms, see + :ref:`sphx_glr_auto_examples_cluster_plot_cluster_comparison.py` """ _parameter_constraints: dict = { diff --git a/sklearn/cluster/_birch.py b/sklearn/cluster/_birch.py index 4d8abb43513dc..4c894a644c8bc 100644 --- a/sklearn/cluster/_birch.py +++ b/sklearn/cluster/_birch.py @@ -483,6 +483,9 @@ class Birch( Birch(n_clusters=None) >>> brc.predict(X) array([0, 0, 0, 1, 1, 1]) + + For a comparison of the BIRCH clustering algorithm with other clustering algorithms, + see :ref:`sphx_glr_auto_examples_cluster_plot_cluster_comparison.py` """ _parameter_constraints: dict = { diff --git a/sklearn/cluster/_dbscan.py b/sklearn/cluster/_dbscan.py index d79c4f286d76d..857a332cc2371 100644 --- a/sklearn/cluster/_dbscan.py +++ b/sklearn/cluster/_dbscan.py @@ -277,9 +277,6 @@ class DBSCAN(ClusterMixin, BaseEstimator): Notes ----- - For an example, see - :ref:`sphx_glr_auto_examples_cluster_plot_dbscan.py`. - This implementation bulk-computes all neighborhood queries, which increases the memory complexity to O(n.d) where d is the average number of neighbors, while original DBSCAN had memory complexity O(n). It may attract a higher @@ -322,6 +319,12 @@ class DBSCAN(ClusterMixin, BaseEstimator): array([ 0, 0, 0, 1, 1, -1]) >>> clustering DBSCAN(eps=3, min_samples=2) + + For an example, see + :ref:`sphx_glr_auto_examples_cluster_plot_dbscan.py`. + + For a comparison of DBSCAN with other clustering algorithms, see + :ref:`sphx_glr_auto_examples_cluster_plot_cluster_comparison.py` """ _parameter_constraints: dict = { diff --git a/sklearn/cluster/_hdbscan/hdbscan.py b/sklearn/cluster/_hdbscan/hdbscan.py index 6eec617b890ab..f292a1f65909b 100644 --- a/sklearn/cluster/_hdbscan/hdbscan.py +++ b/sklearn/cluster/_hdbscan/hdbscan.py @@ -427,10 +427,6 @@ class HDBSCAN(ClusterMixin, BaseEstimator): :class:`~sklearn.cluster.DBSCAN`), and be more robust to parameter selection. Read more in the :ref:`User Guide `. - For an example of how to use HDBSCAN, as well as a comparison to - :class:`~sklearn.cluster.DBSCAN`, please see the :ref:`plotting demo - `. - .. versionadded:: 1.3 Parameters diff --git a/sklearn/cluster/_kmeans.py b/sklearn/cluster/_kmeans.py index 6955de3c385a2..11c85610239cc 100644 --- a/sklearn/cluster/_kmeans.py +++ b/sklearn/cluster/_kmeans.py @@ -1873,6 +1873,9 @@ class MiniBatchKMeans(_BaseKMeans): [1.06896552, 1. ]]) >>> kmeans.predict([[0, 0], [4, 4]]) array([1, 0], dtype=int32) + + For a comparison of Mini-Batch K-Means clustering with other clustering algorithms, + see :ref:`sphx_glr_auto_examples_cluster_plot_cluster_comparison.py` """ _parameter_constraints: dict = { diff --git a/sklearn/cluster/_mean_shift.py b/sklearn/cluster/_mean_shift.py index 5190936e6e39a..c122692cd0c2a 100644 --- a/sklearn/cluster/_mean_shift.py +++ b/sklearn/cluster/_mean_shift.py @@ -432,6 +432,9 @@ class MeanShift(ClusterMixin, BaseEstimator): array([1, 0]) >>> clustering MeanShift(bandwidth=2) + + For a comparison of Mean Shift clustering with other clustering algorithms, see + :ref:`sphx_glr_auto_examples_cluster_plot_cluster_comparison.py` """ _parameter_constraints: dict = { diff --git a/sklearn/cluster/_optics.py b/sklearn/cluster/_optics.py index 223ae426b5951..4b33f03f526fa 100755 --- a/sklearn/cluster/_optics.py +++ b/sklearn/cluster/_optics.py @@ -234,6 +234,9 @@ class OPTICS(ClusterMixin, BaseEstimator): For a more detailed example see :ref:`sphx_glr_auto_examples_cluster_plot_optics.py`. + + For a comparison of OPTICS with other clustering algorithms, see + :ref:`sphx_glr_auto_examples_cluster_plot_cluster_comparison.py` """ _parameter_constraints: dict = { diff --git a/sklearn/cluster/_spectral.py b/sklearn/cluster/_spectral.py index 6d1dcd093e803..e563eac014174 100644 --- a/sklearn/cluster/_spectral.py +++ b/sklearn/cluster/_spectral.py @@ -601,6 +601,9 @@ class SpectralClustering(ClusterMixin, BaseEstimator): >>> clustering SpectralClustering(assign_labels='discretize', n_clusters=2, random_state=0) + + For a comparison of Spectral clustering with other clustering algorithms, see + :ref:`sphx_glr_auto_examples_cluster_plot_cluster_comparison.py` """ _parameter_constraints: dict = { diff --git a/sklearn/mixture/_gaussian_mixture.py b/sklearn/mixture/_gaussian_mixture.py index a5b3a5ae5c172..07933d4e00ea8 100644 --- a/sklearn/mixture/_gaussian_mixture.py +++ b/sklearn/mixture/_gaussian_mixture.py @@ -693,6 +693,9 @@ class GaussianMixture(BaseMixture): [ 1., 2.]]) >>> gm.predict([[0, 0], [12, 3]]) array([1, 0]) + + For a comparison of Gaussian Mixture with other clustering algorithms, see + :ref:`sphx_glr_auto_examples_cluster_plot_cluster_comparison.py` """ _parameter_constraints: dict = {