10

I'm in need for a Javascript implementation of the k-means clustering algorithm. I only have 1-dimensional data and rarely more than 100 items, so performance is not an issue.

PS: I could only find one but it seems extremely unsteady, resulting in completely different clusters on virtually every call.

stephanos
  • 3,319
  • 7
  • 33
  • 47
  • You can try to implement it yourself. If you can't find any implementation, try to do it cos it is not hard to implement. – kamaci Sep 10 '11 at 09:18
  • Did you check here: http://code.google.com/p/bioblitz/source/browse/trunk/ftadmin/public/javascripts/visualization/kmeans.js?r=77 – kamaci Sep 10 '11 at 09:23

3 Answers3

9

k-means in Javascript:

http://code.google.com/p/hdict/source/browse/gae/files/kmeans.js

http://www.mymessedupmind.co.uk/index.php/javascript-k-mean-algorithm

Applet:

http://www.math.le.ac.uk/people/ag153/homepage/KmeansKmedoids/kmeans.jar

cyborg
  • 9,989
  • 4
  • 38
  • 56
6

In node and the browser:

https://github.com/harthur/clusterfck

You have a choice between k-means or hierarchical clustering with these distance functions:

  1. euclidean
  2. manhattan
  3. max
Radek
  • 3,913
  • 3
  • 42
  • 37
0

Simple K-Means implementation: dimas-kmeans

var kmeans = require('dimas-kmeans')

var clusters = kmeans.getClusters(data);
shudima
  • 460
  • 1
  • 5
  • 9