Thanks to visit codestin.com
Credit goes to github.com

Skip to content

mljs/nearest-vector

Repository files navigation

ml-nearest-vector

NPM version npm download test coverage license

Find the nearest point to a sample point

Installation

$ npm install ml-nearest-vector

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

About

Find the nearest point to a sample point

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •