MachineLearning/hierarchical_clustering library
🌲 Hierarchical Clustering (agglomerative, production-aware)
Agglomerative hierarchical clustering with single/complete/average linkage and a simple priority-queue based merge strategy. Designed for clarity and usable defaults in engineering contexts.
Contract:
- Input: feature matrix
X(n x m), desired number of clusters or threshold. - Output: cluster assignments and dendrogram (linkage list).
- Error modes: throws
ArgumentErrorfor empty inputs.
Time Complexity: O(n^2 log n) (naive but robust for moderate n) Space Complexity: O(n^2)