analysis.flag_outlier_runs

analysis.flag_outlier_runs(
    replication_values,
    *,
    value_col='value',
    iqr_multiplier=1.5,
)

Flag replications whose value is a statistical outlier relative to the rest.

Uses Tukey’s fence: a value below Q1 - iqr_multiplier * IQR or above Q3 + iqr_multiplier * IQR is flagged, where IQR = Q3 - Q1 - the same convention error_bars="iqr" on plot_metric_bar/plot_resource_utilisation already uses, just applied as a threshold rather than drawn as an error bar.

Parameters

Name Type Description Default
replication_values pandas.DataFrame One row per replication, e.g. the output of replication_means, or a single group’s rows from resource_utilisation(by="run"). required
value_col str Column holding the per-replication value to check. "value"
iqr_multiplier float Fence width in IQRs. 1.5 is Tukey’s standard “outlier” fence; 3.0 is the wider “far out” fence sometimes used to flag only extreme cases. 1.5

Returns

Name Type Description
pandas.DataFrame replication_values with lower_fence, upper_fence and is_outlier columns added, so a caller sees why each run was (or was not) flagged, not just which ones were.

Raises

Name Type Description
ValueError If iqr_multiplier is negative.

Notes

Quartiles computed from fewer than 4 replications are not very meaningful - a warning is raised in that case, though a result is still returned.

Back to top