k-means-cluster
k-means clustering in configurable dimensions, in-browser and with node.js.
In order to support learning about the algorithm, this library is split into very small bits, so you can use each step separately.
var kmeans = ; var d = 1 2 3;// take a random sample of the array dvar s = kmeans; console;// [1] // Get the euclidean distance between two points represented as// arraysconsole;// 1
In order to support a variety of data, accessors are used in functions like
means_clusters(x, means, distance, val)
(though with good defaults -
distance defaults to euclidean, val defaults to function(x) { return x; }
).
var c = kmeansconsole;// 1
Usage
npm install --save k-means-cluster
Testing
npm test