ml-distance-matrix

2.0.1

distanceMatrix

src/index.js

Computes a distance/similarity matrix given an array of data and a distance/similarity function.

distanceMatrix(data: Array, distanceFn: function): Array<Array>
Parameters
data (Array) An array of data
distanceFn (function) A function that accepts two arguments and computes a distance/similarity between them
Returns
Array<Array>: The distance/similarity matrix. The matrix is square and has a size equal to the length of the data array