(centroid ps)finds the central position of a group of points
(centroid [[3 3] [4 4] [5 5] [6 6]]) => [9/2 9/2]
finds the central position of a group of points (centroid [[3 3] [4 4] [5 5] [6 6]]) => [9/2 9/2]
(cluster ps centroids)takes an array centroids and groups points based upon closest distance
(cluster [[0 0] [1 1] [2 2] [3 3] [4 4] [5 5] [6 6]] [[1 1] [4 4]]) => [[[0 0] [1 1] [2 2]] [[3 3] [4 4] [5 5] [6 6]]]
takes an array centroids and groups points based upon closest distance
(cluster [[0 0] [1 1] [2 2] [3 3] [4 4] [5 5] [6 6]]
[[1 1] [4 4]])
=> [[[0 0] [1 1] [2 2]]
[[3 3] [4 4] [5 5] [6 6]]](distance2 p0 pc)sum of squared distances between two points
(distance2 [1 3 5] [2 4 6]) => 3
sum of squared distances between two points (distance2 [1 3 5] [2 4 6]) => 3
(initial-centroids ps k)finds a set of centroids from the initial set of points
finds a set of centroids from the initial set of points
(k-means ps k)(k-means ps k max-steps)clusters points together based on the number of groups specified
(set (k-means [[0.2 0.4] [0.2 0.3] [0.3 0.4] [1.2 0.4] [1.1 0.3] [2.3 0.4]] 2)) => (any #{[[0.2 0.4] [0.2 0.3] [0.3 0.4]] [[1.2 0.4] [1.1 0.3] [2.3 0.4]]} #{[[0.2 0.4] [0.2 0.3] [0.3 0.4] [1.2 0.4] [1.1 0.3]] [[2.3 0.4]]})
clusters points together based on the number of groups specified
(set (k-means [[0.2 0.4] [0.2 0.3] [0.3 0.4]
[1.2 0.4] [1.1 0.3] [2.3 0.4]]
2))
=> (any #{[[0.2 0.4] [0.2 0.3] [0.3 0.4]]
[[1.2 0.4] [1.1 0.3] [2.3 0.4]]}
#{[[0.2 0.4] [0.2 0.3] [0.3 0.4] [1.2 0.4] [1.1 0.3]]
[[2.3 0.4]]})(min-index p0 centroids)finds the index of the centroid closest to p0
(min-index [0 0] [[-1 -1] [0.5 0.5] [1 1]]) => 1
finds the index of the centroid closest to `p0` (min-index [0 0] [[-1 -1] [0.5 0.5] [1 1]]) => 1
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |