Napoleonic Political Magnificence
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

knn

0.0.2 • Public • Published

K nearest neighbor for objects

var k = require('./lib/index');

var center = { a: 1, b: 2 },
    neighbor = { a: 1, c: 4 };

k.neighbor( center, neighbor ); // return 2 for distance from center to neighbor

neighbor = { a: 1, b: 2 };

k.neighbor( center, neighbor ); // return 0 for distance from center to neighbor

Keywords

none

install

npm i knn

Downloadsweekly downloads

1

version

0.0.2

license

none

last publish

collaborators

  • avatar
Report a vulnerability