package
Find the nearest point to a sample point
npm install ml-nearest-vectorGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Find the nearest point to a sample point
$ npm install ml-nearest-vectorimport 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]Estimated unpacked size across 2 packages.
16.1 kB
Includes dependencies.
targos
npm@secmail.targos.dev