Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return row;
},
});
const years = dv.getColumn('year');
expect(dv.max('year')).to.equal(max(years));
expect(dv.min('year')).to.equal(min(years));
expect(dv.mean('year')).to.equal(mean(years));
expect(dv.average('year')).to.equal(mean(years));
expect(dv.median('year')).to.equal(median(years));
expect(dv.mode('year')).to.equal(mode(years));
expect(dv.quantile('year', 0.5)).to.equal(quantile(years, 0.5));
expect(dv.quantiles('year', [0, 0.1, 0.5])).to.eql(map([0, 0.1, 0.5], (p) => quantile(years, p)));
expect(dv.quantilesByFraction('year', 4)).to.eql(map([0, 0.25, 0.5, 0.75, 1], (p) => quantile(years, p)));
expect(dv.standardDeviation('year')).to.equal(standardDeviation(years));
expect(dv.sum('year')).to.equal(sum(years));
expect(dv.variance('year')).to.equal(variance(years));
expect(dv.range('year')).to.eql([min(years), max(years)]);
});
});
}
const dv = new DataSet.View().source(data);
const values = flattenDeep(dv.getColumn('a'));
expect(dv.max('a')).to.equal(max(values));
expect(dv.min('a')).to.equal(min(values));
expect(dv.mean('a')).to.equal(mean(values));
expect(dv.average('a')).to.equal(mean(values));
expect(dv.median('a')).to.equal(median(values));
expect(dv.mode('a')).to.equal(mode(values));
expect(dv.quantile('a', 0.5)).to.equal(quantile(values, 0.5));
expect(dv.quantiles('a', [0, 0.1, 0.5])).to.eql(map([0, 0.1, 0.5], (p) => quantile(values, p)));
expect(dv.quantilesByFraction('a', 4)).to.eql(map([0, 0.25, 0.5, 0.75, 1], (p) => quantile(values, p)));
expect(dv.standardDeviation('a')).to.equal(standardDeviation(values));
expect(dv.sum('a')).to.equal(sum(values));
expect(dv.variance('a')).to.equal(variance(values));
expect(dv.range('a')).to.eql([min(values), max(values)]);
});
});
constructor(history) {
this.log = getLogger(this.constructor.name);
const profitPercentHistory = history.map(x => x.bestCase.profitPercentAgainstNotional);
this.sampleSize = profitPercentHistory.length;
this.profitPercentMean = this.sampleSize != 0 ? ss.mean(profitPercentHistory) : 0;
this.profitPercentVariance = this.sampleSize != 0 ? ss.variance(profitPercentHistory) : 0;
}
polyFC.features.forEach(function (poly) {
if (!poly.properties) {
poly.properties = {};
}
var values = [];
ptFC.features.forEach(function (pt) {
if (inside(pt, poly)) {
values.push(pt.properties[inField]);
}
});
poly.properties[outField] = ss.variance(values);
});
_.each(polyFC.features, function(poly){
if(!poly.properties){
poly.properties = {}
}
var values = []
_.each(ptFC.features, function(pt){
t.inside(pt, poly, function(err, isInside){
if(isInside){
values.push(pt.properties[inField])
}
})
})
poly.properties[outField] = ss.variance(values)
})
done(null, polyFC)