Angular Constraint Embedding via SpherePair Loss for Constrained Clustering
Shaojie Zhang, Ke Chen
TL;DR
SpherePair introduces an anchor-free, angular constraint embedding for constrained clustering that learns angular representations balancing pairwise constraints in a bounded space. The approach decouples representation learning from clustering by optimizing an angular loss with a reconstruction term, yielding spherical embeddings where positive pairs cluster together and negative pairs occupy a defined negative zone. Theoretical results establish the conditions for a conflict-free embedding, the required embedding dimension $D$ relative to the true cluster count $K$, and a PCA-based method to infer $K$ without retraining. Empirically, SpherePair outperforms state-of-the-art DCC baselines across diverse datasets, handles unknown cluster numbers, and exhibits robustness to constraint imbalance, with practical guidance for hyperparameters. These properties make SpherePair particularly suitable for scalable, real-world constrained clustering tasks where the true number of clusters is not known a priori.
Abstract
Constrained clustering integrates domain knowledge through pairwise constraints. However, existing deep constrained clustering (DCC) methods are either limited by anchors inherent in end-to-end modeling or struggle with learning discriminative Euclidean embedding, restricting their scalability and real-world applicability. To avoid their respective pitfalls, we propose a novel angular constraint embedding approach for DCC, termed SpherePair. Using the SpherePair loss with a geometric formulation, our method faithfully encodes pairwise constraints and leads to embeddings that are clustering-friendly in angular space, effectively separating representation learning from clustering. SpherePair preserves pairwise relations without conflict, removes the need to specify the exact number of clusters, generalizes to unseen data, enables rapid inference of the number of clusters, and is supported by rigorous theoretical guarantees. Comparative evaluations with state-of-the-art DCC methods on diverse benchmarks, along with empirical validation of theoretical insights, confirm its superior performance, scalability, and overall real-world effectiveness. Code is available at \href{https://github.com/spherepaircc/SpherePairCC/tree/main}{our repository}.
