Skip to content

This a variation of k-means algorithm with the same size for each group oriented to waypoints with a distribution heterogeneously on a city

Notifications You must be signed in to change notification settings

jalarrea/kmeans-same-size

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kmeans-same-size

This a variation of k-means algorithm with the same size for each group oriented to waypoints with a distribution heterogeneously on a city.

Installation

$ npm install kmeans-same-size

Example

const KmeansLib = require('kmeans-same-size');
var kmeans = new KmeansLib();
const k = 10; // Groups Number
const size = 3 // Group size

let vectors = [
  { x: -1.10, y: -1.10 },
  { x: -1.20, y: -1.20 },
  { x: -1.30, y: -1.30 },
  { x: -1.40, y: -1.40 },
  { x: -1.50, y: -1.50 },
  { x: -1.60, y: -1.60 },
  { x: -1.70, y: -1.70 },
  { x: -1.80, y: -1.80 },
  { x: -1.90, y: -1.90 },
  { x: -1.91, y: -1.92 },
  { x: -1.93, y: -1.93 }
]

kmeans.init({k: k, runs: size, equalSize: true, normalize: false });

const sum = kmeans.calc(vectors);
The vector is mutated
console.log(vectors);

About

This a variation of k-means algorithm with the same size for each group oriented to waypoints with a distribution heterogeneously on a city

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published