Thetan documentation#
One distance in. Every cluster out.
Thetan is a family of clustering algorithms built around a single distance threshold, θ. Its main method, Thetan Berserker (TB), reads the data twice, corrects its own mistakes and returns the number of clusters it found. You never pass a cluster count.
import numpy as np
from thetan import TB
X = np.ascontiguousarray(points, dtype=np.float64) # (n, d)
centroids, labels = TB(X, theta=3.6) # K is inferred
print(f"{len(centroids)} clusters")
The kernels are written in Cython, run on a single CPU thread and need only NumPy at runtime.
Build thetan from source and cluster your first array.
How one sequential pass works, why it depends on the order of the data, and how the second pass fixes it.
The rule for picking the only parameter, and what happens when it is too small or too large.
Worked examples with their code, output and figures.
Every public function, from its numpydoc docstring.
The guarantees behind each step of TB.