milia.cluster.models.birch#

BIRCH: clustering through a clustering-feature tree.

Classes

Birch([n_clusters, threshold, branching_factor])

BIRCH (Zhang, Ramakrishnan and Livny, 1996).

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

Validated hyperparameters of the BIRCH clusterer.

class milia.cluster.models.birch.Birch(n_clusters=3, threshold=0.5, branching_factor=50)#

Bases: BaseClusterer

BIRCH (Zhang, Ramakrishnan and Livny, 1996).

Parameters:
  • n_clusters (int) – Number of final clusters.

  • threshold (float) – Radius limit of a subcluster.

  • branching_factor (int) – Maximum subclusters per node.

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)
... )
>>> Birch(n_clusters=3).fit(X).n_clusters_
3
class milia.cluster.models.birch.BirchConfig(*, name='birch', kind='clusterer', space=SearchSpace(n_clusters=(2, 12), threshold=(0.1, 1.0)), n_clusters=3, threshold=0.5, branching_factor=50)#

Bases: BaseModelConfig

Validated hyperparameters of the BIRCH clusterer.

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

Examples

>>> BirchConfig().name
'birch'