JSPM

kmeansjs

0.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q47919F

A k-means implementation for JavaScript

Package Exports

  • kmeansjs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (kmeansjs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

A javascript implementation of Kmeans

This is a javascript/node.js based implementation of the kmeans algorithm for clustering vectors.

Technical tutorial

The code/tutorial for this library, created with docco, explains the theory behind kmeans and shows how this library works!

Setup

npm install

Usage

//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
})

Testing

npm test