TorchedUp
ProblemsPremium
TorchedUp
Outlier Detection (IQR)Easy
ProblemsPremium

IQR Outlier Detection

Return the indices of outliers using the Tukey IQR rule.

Signature: def iqr_outliers(x: list, k: float = 1.5) -> list

Let Q1 and Q3 be the 25th and 75th percentiles, IQR = Q3 - Q1. An index i is an outlier if:

x[i] < Q1 - k * IQR or x[i] > Q3 + k * IQR

Return indices in ascending order.

Math

Asked at

Python (numpy)0/3 runs today

Test Results

○one outlier
○no outliers
○two-sided🔒 Premium
Advertisement