JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 68038
  • Score
    100M100P100Q166883F
  • License MIT

K-means in Javascript

Package Exports

  • ml-kmeans

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 (ml-kmeans) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

clustering

NPM version build status David deps npm download

K-means in JavaScript

Installation

npm install ml-kmeans

Methods

kmeans(data, centers, [maxIter], [tol])

Returns an array of cluster indexes for the training dots.

Arguments

  • data: An array of the (x,y) points to cluster, represented also as an array.
  • centers: An array of the K centers in format (x,y), represented also as an array.
  • maxIter: Maximum number of iterations allowed. Its default is 100.
  • tol: The numerical error tolerance. Its default is 1e-6.

Test

$ npm install
$ npm test

Authors

License

MIT