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

Package Sidebar

Install

npm i ml-nearest-vector

Weekly Downloads

22,353

Version

2.0.1

License

MIT

Unpacked Size

8.73 kB

Total Files

7

Last publish

Collaborators

  • mljs-bot
  • stropitek
  • targos
  • lpatiny
  • maasencioh
  • jeffersonh44
  • andcastillo
  • ml-bot