8000 DOC Linked examples for clustering algorithms in their docstrings (#2… · scikit-learn/scikit-learn@7e861bc · GitHub
[go: up one dir, main page]

Skip to content

Commit 7e861bc

Browse files
DOC Linked examples for clustering algorithms in their docstrings (#26927) (#30127)
Co-authored-by: Maren Westermann <maren.westermann@gmail.com>
1 parent 5aece17 commit 7e861bc

File tree

10 files changed

+33
-10
lines changed

10 files changed

+33
-10
lines changed

sklearn/cluster/_affinity_propagation.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,9 +398,6 @@ class AffinityPropagation(ClusterMixin, BaseEstimator):
398398
399399
Notes
400400
-----
401-
For an example usage,
402-
see :ref:`sphx_glr_auto_examples_cluster_plot_affinity_propagation.py`.
403-
404401
The algorithmic complexity of affinity propagation is quadratic
405402
in the number of points.
406403
@@ -442,6 +439,12 @@ class AffinityPropagation(ClusterMixin, BaseEstimator):
442439
>>> clustering.cluster_centers_
443440
array([[1, 2],
444441
[4, 2]])
442+
443+
For an example usage,
444+
see :ref:`sphx_glr_auto_examples_cluster_plot_affinity_propagation.py`.
445+
446+
For a comparison of Affinity Propagation with other clustering algorithms, see
447+
:ref:`sphx_glr_auto_examples_cluster_plot_cluster_comparison.py`
445448
"""
446449

447450
_parameter_constraints: dict = {

sklearn/cluster/_agglomerative.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,9 @@ class AgglomerativeClustering(ClusterMixin, BaseEstimator):
925925
AgglomerativeClustering()
926926
>>> clustering.labels_
927927
array([1, 1, 1, 0, 0, 0])
928+
929+
For a comparison of Agglomerative clustering with other clustering algorithms, see
930+
:ref:`sphx_glr_auto_examples_cluster_plot_cluster_comparison.py`
928931
"""
929932

930933
_parameter_constraints: dict = {

sklearn/cluster/_birch.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,9 @@ class Birch(
483483
Birch(n_clusters=None)
484484
>>> brc.predict(X)
485485
array([0, 0, 0, 1, 1, 1])
486+
487+
For a comparison of the BIRCH clustering algorithm with other clustering algorithms,
488+
see :ref:`sphx_glr_auto_examples_cluster_plot_cluster_comparison.py`
486489
"""
487490

488491
_parameter_constraints: dict = {

sklearn/cluster/_dbscan.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,9 +277,6 @@ class DBSCAN(ClusterMixin, BaseEstimator):
277277
278278
Notes
279279
-----
280-
For an example, see
281-
:ref:`sphx_glr_auto_examples_cluster_plot_dbscan.py`.
282-
283280
This implementation bulk-computes all neighborhood queries, which increases
284281
the memory complexity to O(n.d) where d is the average number of neighbors,
285282
while original DBSCAN had memory complexity O(n). It may attract a higher
@@ -322,6 +319,12 @@ class DBSCAN(ClusterMixin, BaseEstimator):
322319
array([ 0, 0, 0, 1, 1, -1])
323< 10000 code>320
>>> clustering
324321
DBSCAN(eps=3, min_samples=2)
322+
323+
For an example, see
324+
:ref:`sphx_glr_auto_examples_cluster_plot_dbscan.py`.
325+
326+
For a comparison of DBSCAN with other clustering algorithms, see
327+
:ref:`sphx_glr_auto_examples_cluster_plot_cluster_comparison.py`
325328
"""
326329

327330
_parameter_constraints: dict = {

sklearn/cluster/_hdbscan/hdbscan.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -427,10 +427,6 @@ class HDBSCAN(ClusterMixin, BaseEstimator):
427427
:class:`~sklearn.cluster.DBSCAN`), and be more robust to parameter selection.
428428
Read more in the :ref:`User Guide <hdbscan>`.
429429
430-
For an example of how to use HDBSCAN, as well as a comparison to
431-
:class:`~sklearn.cluster.DBSCAN`, please see the :ref:`plotting demo
432-
<sphx_glr_auto_examples_cluster_plot_hdbscan.py>`.
433-
434430
.. versionadded:: 1.3
435431
436432
Parameters

sklearn/cluster/_kmeans.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1873,6 +1873,9 @@ class MiniBatchKMeans(_BaseKMeans):
18731873
[1.06896552, 1. ]])
18741874
>>> kmeans.predict([[0, 0], [4, 4]])
18751875
array([1, 0], dtype=int32)
1876+
1877+
For a comparison of Mini-Batch K-Means clustering with other clustering algorithms,
1878+
see :ref:`sphx_glr_auto_examples_cluster_plot_cluster_comparison.py`
18761879
"""
18771880

18781881
_parameter_constraints: dict = {

sklearn/cluster/_mean_shift.py

Lines changed: 3 additions & 0 deletions
10000
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,9 @@ class MeanShift(ClusterMixin, BaseEstimator):
432432
array([1, 0])
433433
>>> clustering
434434
MeanShift(bandwidth=2)
435+
436+
For a comparison of Mean Shift clustering with other clustering algorithms, see
437+
:ref:`sphx_glr_auto_examples_cluster_plot_cluster_comparison.py`
435438
"""
436439

437440
_parameter_constraints: dict = {

sklearn/cluster/_optics.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,9 @@ class OPTICS(ClusterMixin, BaseEstimator):
234234
235235
For a more detailed example see
236236
:ref:`sphx_glr_auto_examples_cluster_plot_optics.py`.
237+
238+
For a comparison of OPTICS with other clustering algorithms, see
239+
:ref:`sphx_glr_auto_examples_cluster_plot_cluster_comparison.py`
237240
"""
238241

239242
_parameter_constraints: dict = {

sklearn/cluster/_spectral.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,9 @@ class SpectralClustering(ClusterMixin, BaseEstimator):
601601
>>> clustering
602602
SpectralClustering(assign_labels='discretize', n_clusters=2,
603603
random_state=0)
604+
605+
For a comparison of Spectral clustering with other clustering algorithms, see
606+
:ref:`sphx_glr_auto_examples_cluster_plot_cluster_comparison.py`
604607
"""
605608

606609
_parameter_constraints: dict = {

sklearn/mixture/_gaussian_mixture.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,9 @@ class GaussianMixture(BaseMixture):
693693
[ 1., 2.]])
694694
>>> gm.predict([[0, 0], [12, 3]])
695695
array([1, 0])
696+
697+
For a comparison of Gaussian Mixture with other clustering algorithms, see
698+
:ref:`sphx_glr_auto_examples_cluster_plot_cluster_comparison.py`
696699
"""
697700

698701
_parameter_constraints: dict = {

0 commit comments

Comments
 (0)
0