Skip to main content
. Author manuscript; available in PMC: 2024 Jul 1.
Published in final edited form as: IEEE Trans Pattern Anal Mach Intell. 2023 Jun 5;45(7):9149–9168. doi: 10.1109/TPAMI.2023.3237667
Algorithm 2 Hartigan’s K-means
1: Initialize K centroids and label for each point;
2: repeat
3: For each point, find a new centroid via mostly decreasing Eq. (1) after label switching;
4: Recompute the old and new centroids by this point;
5: until The centroids do not change.