EasyDeepLearn
Supervised Learning · section 15 of 18

Missing data & outliers

3 interview questions on missing data & outliers, each answered in full. Free to read, no account needed.

MCAR, MAR, MNAR — what are these and why do they matter?

medium
  • Missing Completely At Random (MCAR): missingness independent of everything — dropping rows is unbiased.
  • Missing At Random (MAR): missingness depends only on observed features — imputation with these features is unbiased.
  • Missing Not At Random (MNAR): missingness depends on the unobserved value itself (e.g., high earners refuse to disclose income) — imputation from observed features is biased; you need external information or explicit modeling.
  • Test empirically: does missingness correlate with observed features?
#missing-data#data-qualityPermalink & quiz →

What is iterative (MICE) imputation?

hard
  • Model each feature with missing values as the target of a regression/classification against all other features; iteratively predict and impute round-robin until convergence.
  • Handles arbitrary correlations, mixed types (with the right per-column estimator), and uncertainty estimates when combined with multiple imputation (average predictions from several draws). scikit-learn's IterativeImputer with BayesianRidge is a solid default; use RandomForest for non-linear relationships.
  • Slower than single imputation but usually gives much better downstream models.

IQR, Z-score, Isolation Forest, LOF — how do you pick an outlier detection method?

medium
  • IQR: 1.5 * IQR beyond Q1/Q3 — robust univariate baseline, great for a quick 'known distribution' check.
  • Z-score (z  >  3)( \mid z \mid \; > \;3): assumes Gaussian, sensitive to the very outliers you want to find.
  • Isolation Forest: randomly partitions space; outliers get isolated in few splits — scalable to large + high-dim, model-agnostic, the default for multivariate anomaly detection.
  • LOF (Local Outlier Factor): compares local density to that of neighbours — good when outliers live in low-density regions of a heterogenous distribution.
  • Rule of thumb: IsolationForest for tabular multivariate, IQR for quick univariate sanity checks.

Practise Supervised Learning