smeans

S-Means clustering

npm install smeans
1 downloads in the last day
5 downloads in the last week
19 downloads in the last month

smeans.js

Build Status

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
npm loves you