Safe Haskell | Safe-Inferred |
---|
Implement clustering
Documentation
cluster_sl :: (Ord a, Ord s) => [(s, a, a)] -> [Clustered s a]Source
Single linkage agglomerative clustering. Cluster elements by slurping a sorted list of pairs with score (i.e. triples :-) Keeps a set of contained elements at each branch's root, so O(n log n), and requires elements to be in Ord. For this to work, the triples must be sorted on score. Earlier scores in the list will make up the lower nodes, so sort descending for similarity, ascending for distance.