Have ideas to improve npm?Join in the discussion! »

ml-nearest-vector
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

nearest-vector

NPM version build status Test coverage David deps npm download

Find the nearest point to a sample point

Installation

$ npm install ml-nearest-vector

API Documentation

Example

import nearestVector, {findNearestVector} from 'ml-nearest-vector');
 
const nearestVector = require('ml-nearest-vector');
 
let centers = [[1, 2, 1], [-1, -1, -1]];
// returns the index of the nearest vector
nearestVector(centers, [1, 2, 1]) === 0;
 
// returns the nearest vector itself
findNearstVector(centers, [1, 2, 1]); // [1, 2, 1]

License

MIT

Install

npm i ml-nearest-vector

DownloadsWeekly Downloads

7,069

Version

2.0.1

License

MIT

Unpacked Size

8.73 kB

Total Files

7

Last publish

Collaborators

  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar