npm.io
0.1.2 • Published 12 years ago

clusteringjs

Licence
Version
0.1.2
Deps
0
Vulns
0
Weekly
0

clusteringjs

K-Means

A Node.js K-Means implementation.

How to use

  1. Install the module

npm install clusteringjs

  1. Create a K-Means object

var clustering = require('clusteringjs');

var kmeans = new clustering.KMeans(k, e); // k = numer of clusters, e = max error

  1. Cluster something

kmeans.cluster(input); // input = array of points

  1. Use the cluster

var clusters = kmeans.getClusters(); var cluster = kmeans.classify(point); // point = [x, y]

http://en.wikipedia.org/wiki/K-means_clustering