Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
add = p => {
const t = {};
for (let i=0; i add([x, model.predict(x)]));
} else {
// otherwise return trend line sample points
sampleCurve(model.predict, dom, 25, 200).forEach(add);
}
});
groups.forEach(g => {
const density = randomKDE(g, bandwidth)[method],
scale = _.counts ? g.length : 1,
local = domain || extent(g);
sampleCurve(density, local, minsteps, maxsteps).forEach(v => {
const t = {};
for (let i=0; i
var dist = parseDist(_.distribution, source(pulse)),
minsteps = _.steps || _.minsteps || 25,
maxsteps = _.steps || _.maxsteps || 200,
method = _.method || 'pdf';
if (method !== 'pdf' && method !== 'cdf') {
error('Invalid density method: ' + method);
}
if (!_.extent && !dist.data) {
error('Missing density extent parameter.');
}
method = dist[method];
var as = _.as || ['value', 'density'],
domain = _.extent || extent(dist.data()),
values = sampleCurve(method, domain, minsteps, maxsteps).map(v => {
var tuple = {};
tuple[as[0]] = v[0];
tuple[as[1]] = v[1];
return ingest(tuple);
});
if (this.value) out.rem = this.value;
this.value = out.add = out.source = values;
}
return out;
};