UNPKG

ml-distance

Version:

Distance and similarity functions to compare vectors

15 lines 404 B
/** *Returns the Neyman distance between vectors a and b * @link [Neyman algorithm](https://www.naun.org/main/NAUN/ijmmas/mmmas-49.pdf) * @param a - first vector * @param b - second vector * */ export default function neyman(a, b) { let d = 0; for (let i = 0; i < a.length; i++) { d += ((a[i] - b[i]) * (a[i] - b[i])) / a[i]; } return d; } //# sourceMappingURL=neyman.js.map