mirror of
https://github.com/yldio/copilot.git
synced 2024-12-01 07:30:07 +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 MockStateTesting from './mock-state-testing.json';
|
||||
import MockState from './mock-state.json';
|
||||
import NormalDatasets from './dataset-leak.json';
|
||||
import LeakDatasets from './dataset-normal.json';
|
||||
import LeakDatasets from './dataset-leak.json';
|
||||
import NormalDatasets from './dataset-normal.json';
|
||||
import Store from '@state/store';
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
|
@ -115,14 +115,29 @@ const metricByInterval = (data = [], {
|
||||
const genStats = (sample) => {
|
||||
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 {
|
||||
start: sample.start.valueOf(),
|
||||
end: sample.end.valueOf(),
|
||||
firstQuartile: statistics.quantile(data, 0.25),
|
||||
median: statistics.median(data),
|
||||
thirdQuartile: statistics.quantile(data, 0.75),
|
||||
max: statistics.max(data),
|
||||
min: statistics.min(data),
|
||||
firstQuartile: q1,
|
||||
median: median,
|
||||
thirdQuartile: q3,
|
||||
max: max,
|
||||
min: min,
|
||||
stddev: statistics.sampleStandardDeviation(data)
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user