Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if( global.argv.fileNames.problemType === 'multi-category' ) {
var allResults = module.exports.multiclassFeatureEngineering( row, classesToIndexMap, indexToClassesMap);
var bestPredictions = global.ensembleNamespace.acceptablePredictions[i];
var bestResults = module.exports.multiclassFeatureEngineering( bestPredictions, classesToIndexMap, indexToClassesMap);
// var aggregatedRow = row.concat(allResults, bestResults);
var aggregatedRow = allResults.concat(bestResults);
global.ensembleNamespace.dataMatrix[i] = aggregatedRow;
} else {
row.push( math.mean(row) );
row.push( math.median(row) );
row.push( math.max(row) );
row.push( math.min(row) );
row.push( math.max(row) - math.min(row) ); // this is the total range of predictions
row.push( math.sum(row) );
row.push( math.var(row) ); //this is the variance
// calculate the consensus vote, as well as what percent of classifiers had that vote.
// console.log('global.argv');
// console.log(global.argv)
if( global.argv.fileNames.problemType === 'category') {
// TODO: generalize this to work with multi-category predictions
var roundedRow = [];
var voteCount = {
0 : 0,
1 : 0
stream.on('data', buffer => {
if(config.debug) console.time("bufferTime");
buffers.push(buffer); // -> save previous recorded data
var headerBuf = header(config.rate, config); // -> create wav header
buffers.unshift(headerBuf); // -> set header in top of buffers
var length = math.sum(buffers.map(b => b.length));
try{
var result = wav.decode(Buffer.concat(buffers, length)) // -> decode buffers to float array
var wave = result.channelData[0];
var slice = wave.slice(0,size);
var fftValues = makeFFT(slice);
callback(fftValues);
if(config.debug) {
console.timeEnd("bufferTime");
console.log("Max: "+math.max(fftValues));
}
}catch(err){
console.error(err);
}
buffers = []; // free recorded data
});
micInstance.start();
var maxp2 = 0;
var maxp3 = 0;
for (var i = 0; i < pts.length; i++) {
var pt = pts[i];
logger.debug(i,
"\t", pt.p1 - ptPrev.p1,
"\t", pt.p1,
"\t", pt.p2,
"\t", pt.p3,
"\t", pt.x,
"\t", pt.y,
"\t", pt.z
);
maxp1 = math.max(maxp1, math.abs(pt.p1 - ptPrev.p1));
maxp2 = math.max(maxp2, math.abs(pt.p2 - ptPrev.p2));
maxp3 = math.max(maxp3, math.abs(pt.p3 - ptPrev.p3));
ptPrev = pt;
if (pt.z > lpp.zHigh - lpp.zVertical) {
math.abs(pt.x).should.below(0.1);
math.abs(pt.y).should.below(0.1);
}
if (z + lpp.zVertical > pt.z) {
math.abs(x - pt.x).should.below(0.1);
math.abs(y - pt.y).should.below(0.1);
}
}
var cmd = new DVSFactory().createDVS(pts);
logger.debug(JSON.stringify(cmd));
});
it("ph5Path(x,y,z) path should accelerate smoothly ", function() {
const renderMatrix = (matrix) => {
const imageData = context2.createImageData(W, H);
const totalMax = Math.max(math.max(matrix), Math.abs(math.min(matrix)));
math.forEach(matrix, (el, [y, x]) => {
const r = 0;
let g = b = 0;
if (el > 0) {
g = 255;
} else {
b = 255;
}
setPixelInImageData(imageData, x, y, r, g, b, Math.abs(el) / totalMax * 255);
});
context2.putImageData(imageData, 0, 0);
}
export function buildMaxDrawdown(state) {
const totals = state.get('history').map(h => h.get('total')).toArray()
const maxReturn = b(math.max(totals))
const drawdowns = totals.map(t => chain(t).subtract(maxReturn).divide(maxReturn).done())
return n(math.min(drawdowns))
}
result.errors[error] += count;
} else {
result.errors[error] = count;
}
});
result.rps.count += stats.rps.count;
result.requestsCompleted += stats.requestsCompleted;
result.pendingRequests += stats.pendingRequests;
});
result.rps.mean = result.rps.count / STATS_INTERVAL;
result.latency.median = math.median(medians);
result.latency.min = math.min(mins);
result.latency.max = math.max(maxs);
result.latency.p95 = math.sum(request95) / result.requestsCompleted;
result.latency.p99 = math.sum(request99) / result.requestsCompleted;
result.scenarioDuration.p95 = math.sum(scenario95) / result.scenariosCompleted;
result.scenarioDuration.p99 = math.sum(scenario99) / result.scenariosCompleted;
return result;
}
result.errors[error] += count;
} else {
result.errors[error] = count;
}
});
});
result.latency.median = math.median(requestMedians);
result.latency.min = math.min(requestMins);
result.latency.max = math.max(requestMaxs);
result.latency.p95 = math.sum(request95) / result.requestsCompleted;
result.latency.p99 = math.sum(request99) / result.requestsCompleted;
result.scenarioDuration.median = math.median(scenarioMedians);
result.scenarioDuration.min = math.min(scenarioMins);
result.scenarioDuration.max = math.max(scenarioMaxs);
result.scenarioDuration.p95 = math.sum(scenario95) / result.scenariosCompleted;
result.scenarioDuration.p99 = math.sum(scenario99) / result.scenariosCompleted;
return result;
}
const maxDistanceFromCentroid = (centroid, origins) => {
const dists = origins.map(coord => math.distance(coord, centroid))
return math.max(dists)
}