smeans
S-Means clustering
npm install smeans
Want to see pretty graphs? Log in now!
1 | downloads in the last week |
19 | downloads in the last month |
Last Published By | |
---|---|
Version | 0.0.3 last updated 2 years ago |
License | BSD |
Keywords | clustering, s-means, k-means, smeans, kmeans, statistics, math |
Repository | https://github.com/c0bra/s-means.js.git (git) |
Dependencies | None |
smeans.js
S-Means clustering in javascript
What?
S-Means is a clustering algorithm similar to K-Means, but it does not need a initial value for K (number of clusters).
There is a white-paper on S-Means here.
Why?
Clustering data. when you don't know the initial number of clusters to use, is pretty hard. Deciding the value for K is the subject of a whole slew of papers. S-Means makes it easier. Let the algorithm decide.
OK, how do I use it?
JavaScript
var smeans = require('smeans');
var data = [1, 2, 3, 101, 102, 103];
var clusters = smeans.cluster(data);
// clusters =
{
1: {
elements: [
1,
2,
3,
],
i: 1,
centroid: 2
},
2: {
elements: [
101,
102,
103,
],
i: 2,
centroid: 101
}
}
CoffeeScript
smeans = require('smeans')
data = [1, 2, 3, 101, 102, 103]
clusters = smeans.cluster data