milia.cluster.models.agglomerative#
Agglomerative (hierarchical) clustering.
Classes
|
Bottom-up hierarchical clustering. |
|
Validated hyperparameters of the agglomerative clusterer. |
- class milia.cluster.models.agglomerative.Agglomerative(n_clusters=3, linkage='ward', metric='euclidean')#
Bases:
BaseClustererBottom-up hierarchical clustering.
With
metric="precomputed"it clusters a square distance matrix directly, as the CROCS representation needs (linkagemust then not be"ward").- Parameters:
Examples
>>> import numpy as np >>> rng = np.random.default_rng(0) >>> X = np.repeat(np.array([[0.0, 0.0], [6.0, 6.0], [0.0, 6.0]]), 20, axis=0) + rng.normal( ... scale=0.4, size=(60, 2) ... ) >>> Agglomerative(n_clusters=3).fit(X).n_clusters_ 3
- class milia.cluster.models.agglomerative.AgglomerativeConfig(*, name='agglomerative', kind='clusterer', space=SearchSpace(n_clusters=(2, 12), linkage=['ward', 'average']), n_clusters=3, linkage='ward', metric='euclidean')#
Bases:
BaseModelConfigValidated hyperparameters of the agglomerative clusterer.
Fields mirror
Agglomerative’s constructor;spaceis the default Optuna search space. Build the clusterer withmake("clusterer", "agglomerative", ...)orAgglomerative(**config.params()).Examples
>>> AgglomerativeConfig().name 'agglomerative'