Step 01 Alg. 2 · lines 3–5
Pass 1 · Thetan Sequential
Shuffle the data, then visit each point exactly once. A point joins the nearest centroid
if it is closer than θ, and that centroid's running mean moves toward it. Otherwise
the point opens a new cluster.
for x in shuffle(X):
μ ← nearest centroid
if ‖x − μ‖ < θ: join μ, update its mean
else: open a new cluster at x
Fast and online, but order-sensitive: centroids are still moving, so an early point can open
a cluster between two true groups.
Step 02 Alg. 2 · lines 6–7
Cleanup · TS on the centroids
Run the very same TS on the centroids alone. Centroids within θ of each other land in one group.
The oldest is kept, and the rest are flagged as spurious (ζ₁).
No new machinery: TB reuses TS on the data, on the centroids, and on both together.
Step 03 Alg. 2 · lines 8–10
Delete & reassign
Spurious centroids are deleted. Their points move to the nearest surviving centroid, and
centroids are recomputed from the labels (M⋆₂).
This removes duplicates, but it cannot undo early assignments. Hence a second pass.
Step 04 Alg. 2 · lines 11–13
Pass 2 · Prepend, then re-shuffle
The key move. The cleaned centroids are placed in front of a fresh permutation of the
data, M⋆₂ ∪ X₂. Every berserker claims its territory before the first data point arrives.
Each point is now compared with near-final centroids instead of whichever points happened to come first.
Step 05 Alg. 2 · lines 14–19
Second cleanup · a fixed point
A last cleanup removes the few spurious centroids that outliers create in pass 2, and the
permutation is inverted. TB returns centroids M⋆ and labels λ⋆.
Two passes suffice. Running up to 14 iterations gives no further gain in NMI (paper, Fig. 8B).