Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { default as ml, } from 'ml';
import { default as range, } from 'lodash.range';
import { default as rangeRight, } from 'lodash.rangeright';
const avg = ml.ArrayStat.mean;
const mean = avg;
const sum = ml.ArrayStat.sum;
const scale = (a, d) => a.map(x => (x - avg(a)) / d);
const max = a => a.concat([]).sort((x, y) => x < y)[0];
const min = a => a.concat([]).sort((x, y) => x > y)[0];
const sd = ml.ArrayStat.standardDeviation; //(a, av) => Math.sqrt(avg(a.map(x => (x - av) * x)));
/**
* Returns an array of the squared different of two arrays
* @memberOf util
* @param {Number[]} left
* @param {Number[]} right
* @returns {Number[]} Squared difference of left minus right array
*/
function squaredDifference(left, right) {
return left.reduce((result, val, index, arr) => {
result.push(Math.pow((right[index]-val), 2));
return result;
}, []);
}
import { default as ml, } from 'ml';
import { default as range, } from 'lodash.range';
import { default as rangeRight, } from 'lodash.rangeright';
const avg = ml.ArrayStat.mean;
const mean = avg;
const sum = ml.ArrayStat.sum;
const scale = (a, d) => a.map(x => (x - avg(a)) / d);
const max = a => a.concat([]).sort((x, y) => x < y)[0];
const min = a => a.concat([]).sort((x, y) => x > y)[0];
const sd = ml.ArrayStat.standardDeviation; //(a, av) => Math.sqrt(avg(a.map(x => (x - av) * x)));
/**
* Returns an array of the squared different of two arrays
* @memberOf util
* @param {Number[]} left
* @param {Number[]} right
* @returns {Number[]} Squared difference of left minus right array
*/
function squaredDifference(left, right) {