mirror of
https://github.com/yldio/copilot.git
synced 2024-11-10 21:30:06 +02:00
Add normal metrics data
This commit is contained in:
parent
c72bef0553
commit
7a2a1f95a6
File diff suppressed because it is too large
Load Diff
@ -9,8 +9,8 @@ import App from '@containers/app';
|
|||||||
// import MockState from './mock-state.json';
|
// import MockState from './mock-state.json';
|
||||||
import MockStateTesting from './mock-state-testing.json';
|
import MockStateTesting from './mock-state-testing.json';
|
||||||
import MockState from './mock-state.json';
|
import MockState from './mock-state.json';
|
||||||
import NormalDatasets from './dataset-leak.json';
|
import LeakDatasets from './dataset-leak.json';
|
||||||
import LeakDatasets from './dataset-normal.json';
|
import NormalDatasets from './dataset-normal.json';
|
||||||
import Store from '@state/store';
|
import Store from '@state/store';
|
||||||
|
|
||||||
if (process.env.NODE_ENV !== 'production') {
|
if (process.env.NODE_ENV !== 'production') {
|
||||||
|
@ -115,14 +115,29 @@ const metricByInterval = (data = [], {
|
|||||||
const genStats = (sample) => {
|
const genStats = (sample) => {
|
||||||
const data = sample.values.map((r) => r.v);
|
const data = sample.values.map((r) => r.v);
|
||||||
|
|
||||||
|
const q1 = statistics.quantile(data, 0.25);
|
||||||
|
const median = statistics.median(data);
|
||||||
|
const q3 = statistics.quantile(data, 0.75);
|
||||||
|
|
||||||
|
const iqr = q3-q1;
|
||||||
|
const outlierMultiplier = 3;
|
||||||
|
let max = statistics.max(data);
|
||||||
|
if(max < q3 + iqr*outlierMultiplier) {
|
||||||
|
max = q3;
|
||||||
|
}
|
||||||
|
let min = statistics.min(data);
|
||||||
|
if(min > q1 - iqr*outlierMultiplier){
|
||||||
|
min = q3;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
start: sample.start.valueOf(),
|
start: sample.start.valueOf(),
|
||||||
end: sample.end.valueOf(),
|
end: sample.end.valueOf(),
|
||||||
firstQuartile: statistics.quantile(data, 0.25),
|
firstQuartile: q1,
|
||||||
median: statistics.median(data),
|
median: median,
|
||||||
thirdQuartile: statistics.quantile(data, 0.75),
|
thirdQuartile: q3,
|
||||||
max: statistics.max(data),
|
max: max,
|
||||||
min: statistics.min(data),
|
min: min,
|
||||||
stddev: statistics.sampleStandardDeviation(data)
|
stddev: statistics.sampleStandardDeviation(data)
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user