headers.push("Mean"); data.push(item.mean); headers.push("Var"); data.push(item.variance); headers.push("StdDev"); data.push(item.stdDev);
metric: this.formatMetricName(metric.name + ".mean"), type: "rate", points: [[now, item.mean]], tags: this.labelsToTags(item.labels), host: this.opts.host
content.push(`${metricName}_count${labelStr} ${val(item.count)}`); content.push(`${metricName}_min${labelStr} ${val(item.min)}`); content.push(`${metricName}_mean${labelStr} ${val(item.mean)}`); content.push(`${metricName}_variance${labelStr} ${val(item.variance)}`); content.push(`${metricName}_stddev${labelStr} ${val(item.stdDev)}`);
function extractCalculateObject(dataObject) { const totalRequests = dataObject.rps.count; return { rps: dataObject.rps.mean, percentile_ninety_five: dataObject.latency.p95, percentile_fifty: dataObject.latency.median, client_errors_ratio: extractNumberOfErrorsPrefix(dataObject.codes, FOUR_PREFIX) / totalRequests, server_errors_ratio: calculateServerErrors(dataObject) / totalRequests }; }
function getAverages(values) { return { mean: stats.mean(values), median: stats.median(values), stdev: stats.stdev(values), max: Math.max(...values), min: Math.min(...values) }; }
describe('Mean threshold', function () { it('Should work like ImageJ', async () => { const img = await load('grayscale_by_zimmyrose.png'); expect(mean(img.histogram, img.size)).toBe(106); }); });
function prepareResults(responseTimesHR, timeSpentHR) { const hrtimeToNSeconds = hrtime => hrtime[0] * 1e9 + hrtime[1]; responseTimesHR = responseTimesHR.reduce( (previous, current) => previous.concat(current), [] ); const responseTimes = responseTimesHR.map(hrtimeToNSeconds); const timeSpent = hrtimeToNSeconds(timeSpentHR); const mean = statistics.mean(responseTimes); const stdev = statistics.stdev(responseTimes, mean); return [mean, stdev, timeSpent]; }
function stddevReducer(acc, features) { for (let i = 0; i < features.length; i++) { let delta = features[i] - acc.mean[i]; acc.sum[i] = (acc.sum[i] || 0) + delta * delta; } return acc; }
normalize(inputs) { const obsMean = this.mean; const obsStd = N.sqrt(this.variance); return N.div(N.sub(inputs, obsMean), obsStd); }
describe('check sum', function () { it('should yield the correct array', function () { let image = new Image(1, 2, [230, 84, 121, 255, 100, 140, 13, 255]); expect(image.mean).toStrictEqual([165, 112, 67]); expect(image.getMean()).toStrictEqual([165, 112, 67]); image = new Image(1, 2, [230, 84, 121, 255, 100, 140, 13, 0]); expect(image.mean).toStrictEqual([230, 84, 121]); expect(image.getMean()).toStrictEqual([230, 84, 121]); }); });
function calculateDelta (bench, control) { // moe: The margin of error // rme: The relative margin of error (expressed as a percentage of the mean) // sem: The standard error of the mean // deviation: The sample standard deviation // mean: The sample arithmetic mean (secs) // variance: The sample variance bench.overhead = bench.stats.mean - control.stats.mean }
const combineMean = (samples, count) => { let sum = 0; for (let i = 0; i < samples.length; i++) { const sample = samples[i]; sum += sample.mean * sample.count; } return sum / count; }