Skip to content

Commit a6c7b5b

Browse files
committed
Update Readthedocs
1 parent 360cf03 commit a6c7b5b

2 files changed

Lines changed: 64 additions & 1 deletion

File tree

docs/index.rst

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ Implemented Algorithms
107107
* :ref:`Alternating<alternating>` (k-means-style approach)
108108
* :ref:`BUILD<build>` (Kaufman and Rousseeuw, 1987)
109109
* :ref:`Silhouette<silhouette>` (Kaufman and Rousseeuw, 1987)
110+
* :ref:`FasterMSC<fastermsc>` (Lenssen and Schubert, 2022)
111+
* :ref:`FastMSC<fastmsc>` (Lenssen and Schubert, 2022)
112+
* :ref:`PAMSIL<pamsil>` (Van der Laan and Pollard, 2003)
113+
* :ref:`PAMMEDSIL<pammedsil>` (Van der Laan and Pollard, 2003)
110114

111115
Note that the k-means style "alternating" algorithm yields rather poor result quality.
112116

@@ -152,6 +156,34 @@ Silhouette
152156

153157
.. autofunction:: silhouette
154158

159+
.. _FasterMSC:
160+
161+
FasterMSC
162+
=========
163+
164+
.. autofunction:: fastermsc
165+
166+
.. _FastMSC:
167+
168+
FastMSC
169+
=========
170+
171+
.. autofunction:: fastmsc
172+
173+
.. _PAMSIL:
174+
175+
PAMSIL
176+
=========
177+
178+
.. autofunction:: pamsil
179+
180+
.. _PAMMEDSIL:
181+
182+
PAMMEDSIL
183+
=========
184+
185+
.. autofunction:: pammedsil
186+
155187
.. _KMedoidsResult:
156188

157189
k-Medoids result object
@@ -189,6 +221,12 @@ an earlier (slower, and now obsolete) version was published as:
189221
| https://doi.org/10.1007/978-3-030-32047-8_16
190222
| Preprint: https://arxiv.org/abs/1810.05691
191223
224+
For further details on the implemented algorithm FasterMSC, see:
225+
226+
| Lars Lenssen, Erich Schubert:
227+
| Clustering by Direct Optimization of the Medoid Silhouette
228+
| In: 15th International Conference on Similarity Search and Applications (SISAP 2022).
229+
192230
This is a port of the original Java code from `ELKI <https://elki-project.github.io/>`_ to Rust.
193231
The `Rust version <https://github.com/kno10/rust-kmedoids>`_ is then wrapped for use with Python.
194232

kmedoids/__init__.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@
4949
| Silhouettes: A graphical aid to the interpretation and validation of cluster analysis
5050
| Journal of Computational and Applied Mathematics, Volume 20, 1987
5151
| https://doi.org/10.1016/0377-0427(87)90125-7
52+
53+
| Mark Van der Laan, Katherine Pollard, Jennifer Bryan:
54+
| A new partitioning around medoids algorithm.
55+
| In: Journal of Statistical Computation and Simulation, pp 575-584, 2003
56+
| https://doi.org/10.1080/0094965031000136012
57+
5258
"""
5359
__all__ = [
5460
"pam",
@@ -368,6 +374,7 @@ def pammedsil(diss, medoids, max_iter=100, init="build", random_state=None):
368374
| Mark Van der Laan, Katherine Pollard, Jennifer Bryan:
369375
| A new partitioning around medoids algorithm.
370376
| In: Journal of Statistical Computation and Simulation, pp 575-584, 2003
377+
| https://doi.org/10.1080/0094965031000136012
371378
372379
:param diss: square numpy array of dissimilarities
373380
:type diss: ndarray
@@ -409,6 +416,7 @@ def pamsil(diss, medoids, max_iter=100, init="build", random_state=None):
409416
| Mark Van der Laan, Katherine Pollard, Jennifer Bryan:
410417
| A new partitioning around medoids algorithm.
411418
| In: Journal of Statistical Computation and Simulation, pp 575-584, 2003
419+
| https://doi.org/10.1080/0094965031000136012
412420
413421
:param diss: square numpy array of dissimilarities
414422
:type diss: ndarray
@@ -654,6 +662,10 @@ class KMedoids(SKLearnClusterer):
654662
| https://doi.org/10.1007/978-3-030-32047-8_16
655663
| Preprint: https://arxiv.org/abs/1810.05691
656664
665+
| Lars Lenssen, Erich Schubert:
666+
| Clustering by Direct Optimization of the Medoid Silhouette
667+
| In: 15th International Conference on Similarity Search and Applications (SISAP 2022).
668+
657669
| Leonard Kaufman, Peter J. Rousseeuw:
658670
| Clustering by means of medoids.
659671
| In: Dodge Y (ed) Statistical Data Analysis Based on the L 1 Norm and Related Methods, 405-416, 1987
@@ -662,6 +674,11 @@ class KMedoids(SKLearnClusterer):
662674
| Finding Groups in Data: An Introduction to Cluster Analysis.
663675
| John Wiley&Sons, 1990, https://doi.org/10.1002/9780470316801
664676
677+
| Mark Van der Laan, Katherine Pollard, Jennifer Bryan:
678+
| A new partitioning around medoids algorithm.
679+
| In: Journal of Statistical Computation and Simulation, pp 575-584, 2003
680+
| https://doi.org/10.1080/0094965031000136012
681+
665682
:param n_clusters: The number of clusters to form
666683
:type n_clusters: int
667684
:param metric: It is recommended to use 'precomputed', in particular when experimenting with different `n_clusters`.
@@ -670,7 +687,7 @@ class KMedoids(SKLearnClusterer):
670687
:param metric_params: Additional keyword arguments for the metric function.
671688
:type metric_params: dict, default=None
672689
:param method: Which algorithm to use
673-
:type method: string, "fasterpam" (default), "fastpam1", "pam" or "alternate"
690+
:type method: string, "fasterpam" (default), "fastpam1", "pam", "alternate", "fastermsc", "fastmsc", "pamsil" or "pammedsil"
674691
:param init: initialization method
675692
:type init: string, "random" (default), "first" or "build"
676693
:param max_iter: Specify the maximum number of iterations when fitting
@@ -730,6 +747,14 @@ def fit(self, X, y=None):
730747
result = fastpam1(X, self.n_clusters, self.max_iter, self.init, random_state=self.random_state)
731748
elif self.method == "pam":
732749
result = pam(X, self.n_clusters, self.max_iter, self.init, random_state=self.random_state)
750+
elif self.method == "fastermsc":
751+
result = fastermsc(X, self.n_clusters, self.max_iter, self.init, random_state=self.random_state)
752+
elif self.method == "fastmsc":
753+
result = fastmsc(X, self.n_clusters, self.max_iter, self.init, random_state=self.random_state)
754+
elif self.method == "pamsil":
755+
result = pamsil(X, self.n_clusters, self.max_iter, self.init, random_state=self.random_state)
756+
elif self.method == "pammedsil":
757+
result = pammedsil(X, self.n_clusters, self.max_iter, self.init, random_state=self.random_state)
733758
elif self.method == "alternate":
734759
result = alternating(X, self.n_clusters, self.max_iter, self.init, random_state=self.random_state)
735760
else:

0 commit comments

Comments
 (0)