API Reference / algorithms /

clustering/

Unsupervised algorithms for grouping similar data instances.

Clusterers find structure without labels. They differ mainly in what they assume a cluster is — a centroid, a density region, or a node in a hierarchy — so the right choice depends on the shape you expect.

Algorithms

  • KMeansClusterer: Partition into k spherical clusters by centroid.
  • GaussianMixtureClusterer: Soft assignment via expectation-maximisation.
  • DBSCANClusterer: Density-based; finds arbitrary shapes and labels
sparse points as noise, without being told how many clusters to expect.
  • DensityBasedClusterer: Density estimation wrapped around a clusterer.
  • AgglomerativeClusterer: Bottom-up hierarchy of merges.

Notes

Every distance-based clusterer here takes its metric from distance, which is re-exported at this level. Scale features first when using Euclidean distance, or the widest-ranging column silently dominates the metric.
python
>>> from tuiml.algorithms.clustering import KMeansClusterer
>>> from tuiml.datasets import load_iris
>>> data = load_iris()
>>> labels = KMeansClusterer(n_clusters=3, random_state=0).fit_predict(data.X)
>>> len(set(labels.tolist()))
3

Packages


Modules