k-nearest-neighbors

2.0.0 • Public • Published

k-nearest-neighbors

Classify an entity based on its neighbors.

Example:

const KNearestNeighbors = require('k-nearest-neighbors')
const machine = new KNearestNeighbors([
  {
    x: 0,
    y: 0,
    class: 'good',
  },
  {
    x: 10,
    y: 10,
    class: 'bad',
  },
  {
    x: 1,
    y: 1,
    class: 'ugly',
  },
], [
  'x',
  'y',
])
machine.classify({
  x: 1,
  y: 1,
}, 1, 'class')
// → 'ugly'

Readme

Keywords

none

Package Sidebar

Install

npm i k-nearest-neighbors

Weekly Downloads

0

Version

2.0.0

License

MIT

Last publish

Collaborators

  • flipactual