Skip to main content
[Preprint]. 2023 Jan 18:2023.01.15.524135. [Version 1] doi: 10.1101/2023.01.15.524135

Algorithm 1.

Constrained K-means

1: Initialize K, n
2: Input: Normalized data X, initial centroids {x¯1,,x¯K+1} and cell representatives {R1, R2…..RK + 1}
3: For iter = 1, 2, … , n
4: Cluster assignment:
5:   Li={kwhenxiRkargminkxix¯k2,otherwise
6: Centroid computation
7: x¯k=1|Ck|xiCkxi
8: End For
9: Return: Labels L, Centroids x¯