Skip to content

Commit

Permalink
Improve outliers
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Sep 26, 2021
1 parent 4b78e2e commit e28b6b4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/stats/outliers_logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@ import { getQuantiles } from './quantile.js'
// threshold is close a big outlier.
// This is applied separately on max and min outliers.
export const getOutliersPercentages = function (measures) {
const length = Math.ceil(1 / OUTLIERS_GRANULARITY)
if (measures.length <= 2) {
return { outliersMin: 0, outliersMax: 0 }
}

const length = Math.min(
Math.ceil(1 / OUTLIERS_GRANULARITY),
measures.length - 1,
)
const quantiles = getQuantiles(measures, length)
const { outliersMin, outliersMax } = getOutliers(quantiles, length)
return { outliersMin, outliersMax }
Expand Down

0 comments on commit e28b6b4

Please sign in to comment.