milia.cluster.models.hdbscan#

HDBSCAN: hierarchical density-based clustering.

Classes

HDBSCAN([min_cluster_size, min_samples, metric])

HDBSCAN (Campello, Moulavi and Sander, 2013); needs no eps and no k.

HDBSCANConfig(*[, name, kind, space, ...])

Validated hyperparameters of the HDBSCAN clusterer.

class milia.cluster.models.hdbscan.HDBSCAN(min_cluster_size=5, min_samples=None, metric='euclidean')#

Bases: BaseClusterer

HDBSCAN (Campello, Moulavi and Sander, 2013); needs no eps and no k.

Parameters:
  • min_cluster_size (int) – Smallest group counted as a cluster.

  • min_samples (int | None) – Density smoothing; None uses min_cluster_size.

  • metric (str) – Distance metric.

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)
... )
>>> HDBSCAN().fit(X).n_clusters_
3
class milia.cluster.models.hdbscan.HDBSCANConfig(*, name='hdbscan', kind='clusterer', space=SearchSpace(min_cluster_size=(3, 50)), min_cluster_size=5, min_samples=None, metric='euclidean')#

Bases: BaseModelConfig

Validated hyperparameters of the HDBSCAN clusterer.

Fields mirror HDBSCAN’s constructor; space is the default Optuna search space. Build the clusterer with make("clusterer", "hdbscan", ...) or HDBSCAN(**config.params()).

Examples

>>> HDBSCANConfig().name
'hdbscan'