ckmeans
Ckmeans Javascript Implementation - Fast Univariate Clustering
Last updated 25 days ago by dschnurr .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install ckmeans 
SYNC missed versions from official npm registry.

ckmeans

A javascript implementation of the ckmeans algorithm. It's effectively a 1-dimensional version of kmeans, where a set of values are clustered into discrete groups. The algorithm has an O(kn log(n)) runtime.

There is also a native version of this package if you need faster performance in node environments, see ckmeans-native

For an alternative API used commonly in data visualization applications, check out d3-scale-cluster.

Getting Started

Using npm

Install the npm package

npm install --save ckmeans

Load into your project

// Using ES6 imports
import ckmeans from 'ckmeans';

// Or, using require
var ckmeans = require('ckmeans');

You can also use something like unpkg.com to include it via <script> tag in the browser.

Example Usage

This function returns the first value in each cluster

var result = ckmeans([1, 2, 4, 5, 12, 43, 52, 123, 234, 1244], 6);
// [1, 12, 43, 123, 234, 1244]

Thanks

Thanks to Haizhou Wang and Mingzhou Song for developing the original Ckmeans 1D clustering algorithm

Contributing

yarn
yarn test  # run tests
yarn build # build distributable files

Publishing

  1. Build distributable file for browser: yarn build
  2. Update CHANGELOG.md with changes in next version bump
  3. Create new npm version: npm version [major|minor|patch]
  4. Push to github with new version tag: git push origin --tags
  5. Publish to npm: npm publish

Current Tags

  • 2.1.0                                ...           latest (25 days ago)

5 Versions

  • 2.1.0                                ...           25 days ago
  • 2.0.1                                ...           7 months ago
  • 2.0.0                                ...           7 months ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 10
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dependents (1)

Copyright 2014 - 2016 © taobao.org |