This is a javascript/node.js based implementation of the kmeans algorithm for clustering vectors.
The code/tutorial for this library, created with docco, explains the theory behind kmeans and shows how this library works!
npm install kmeansjs
or manually
git clone https://github.com/stevemacn/kmeans
npm install
//Creating 3 clusters with vector dataset
var vector = [
[10, 2, 30],
[30, 20, 2],
[30, 30, 3],
[10, 10, 1],
[20, 1, 30],
[1, 25, 30]
]
kmeans(vector, 3, function(err, res) {
if (err) throw new Error(err)
//do something with the result
})
npm test