lambda-ml.clustering.hierarchical
Hierarchical agglomerative clustering.
Example usage:
(def data [[1 1 1 0 1 0 0 1 1 1]
[1 1 0 1 1 0 0 0 0 1]
[0 1 1 0 1 0 0 1 0 0]
[0 0 0 1 0 1 0 0 0 0]
[1 1 1 0 1 0 1 1 1 0]
[0 1 0 1 1 0 0 0 0 1]
[0 1 1 0 1 1 0 1 1 0]])
(agglomerative-clustering single-link lambda-ml.distance/euclidean data)
;;=> [[1 5] [0 4] [2 6] [0 2] [0 1] [0 3]]
agglomerative-clustering
(agglomerative-clustering link f points)
Returns a clustering of points represented as a seq of merges, where each merge is a pair of indexes indicating the two points to be merged at each step, using the linkage function link and distance function f.
complete-link
(complete-link distances x y z)
Returns the complete-link distance between point x and the merged cluster containing points y and z, which is the distance between x and the farthest point in the cluster.
distance-queues
(distance-queues distances)
Returns a map of each point to a priority queue of all other points sorted by increasing distance.
pairwise-distances
(pairwise-distances f points)
Returns a map representing the distance matrix between all points.
single-link
(single-link distances x y z)
Returns the single-link distance between point x and the merged cluster containing points y and z, which is the distance between x and the closest point in the cluster.