Members
arrayToObject
Converts an array
of arrays into an array of objects, given a list of ordered keys
average
Calculate the average between the points inside data
- returns just the average value if
data
is an array of values - returns an array of averages if
data
is an array of arrays
Distances
Class used to handle distances functions
Example
//new instance
let distances = new Distances();
//define two points
let point1 = [1,3];
let point2 = [4,-2];
//minkowski distance from two points
let minkowski_distance = distances.minkowski(point1,point2);
//chebyshev distance from two points
let chebyshev_distance = distances.chebyshev(point1,point2);
//mahalanobis distance from two points
let mahalanobis_distance = distances.mahalanobis(point1,point2);
//setting the grade for minkowski
distances.setMinkowskiDegree(2);
extractKeys
Extracts the keys from an objects and put them inside an array as strings
objectToArray
Converts an array of object into an array of arrays
randfArray
Generate an array of N
elements filled with random float between a
and b
randiArray
Generate an array of N
elements filled with random integer between a
and b
variance
Calculate the variance between the points inside data
- returns just the variance value if
data
is an array of values - returns an array of variances if
data
is an array of arrays