https://github.com/mljs/distance-matrix
Compute a distance-matrix based on a custom distance function
https://github.com/mljs/distance-matrix
Last synced: 3 months ago
JSON representation
Compute a distance-matrix based on a custom distance function
- Host: GitHub
- URL: https://github.com/mljs/distance-matrix
- Owner: mljs
- License: mit
- Created: 2017-02-10T12:04:29.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2022-03-06T11:29:17.000Z (almost 4 years ago)
- Last Synced: 2024-11-02T06:09:31.709Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 1.16 MB
- Stars: 4
- Watchers: 8
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# distance-matrix
[![NPM version][npm-image]][npm-url]
[![Test coverage][codecov-image]][codecov-url]
[![npm download][download-image]][download-url]
Compute a distance/similarity matrix.
## Installation
`npm i ml-distance-matrix`
## [API Documentation](https://mljs.github.io/distance-matrix/)
## Example
```js
const distanceMatrix = require('ml-distance-matrix');
const { euclidean } = require('ml-distance-euclidean');
// Computes euclidan distance for each pair of possible vectors
const matrix = distanceMatrix([[8, -1, 2], [-4, 0, 3], [-3, -1, 6]], euclidean);
```
## License
[MIT](./LICENSE)
[npm-image]: https://img.shields.io/npm/v/ml-distance-matrix.svg?style=flat-square
[npm-url]: https://npmjs.org/package/ml-distance-matrix
[codecov-image]: https://img.shields.io/codecov/c/github/mljs/distance-matrix.svg?style=flat-square
[codecov-url]: https://codecov.io/gh/mljs/distance-matrix
[download-image]: https://img.shields.io/npm/dm/ml-distance-matrix.svg?style=flat-square
[download-url]: https://npmjs.org/package/ml-distance-matrix