Handling Missing Values and Outliers in Machine Learning
You are building classification and regression models on tabular business data with missing values and potential outliers. You must choose data treatments, evaluation metrics, and modeling approaches suitable for production.
Constraints & Assumptions
-
Distinguish data cleaning from model-specific preprocessing.
-
Fit imputers, scalers, and transformations on training data only.
-
Explain when missingness or outliers contain signal rather than noise.
-
Discuss production consistency between training and serving.
Clarifying Questions to Ask
-
Why are values missing: random missingness, system failure, user behavior, or not applicable?
-
What percentage of data is missing or outlying by feature and segment?
-
Which model classes are being considered?
-
What business metric matters most for classification and regression performance?
Part 1 - Missing Values
Describe at least two methods to handle missing values and give pros and cons.
What This Part Should Cover
-
Include deletion, simple imputation, model-based imputation, missing indicators, native missing handling, or domain-specific defaults.
-
Discuss bias, variance, sample size, interpretability, leakage, and production feasibility.
-
Consider missing-not-at-random patterns and segment-specific missingness.
Part 2 - Outliers
Provide two strategies for treating outliers and explain when to use each.
What This Part Should Cover
-
Include investigation, capping or winsorization, transformations, robust models/losses, filtering data errors, or separate anomaly treatment.
-
Distinguish legitimate rare behavior from measurement error.
-
Explain effects on linear models, distance-based methods, trees, and business interpretation.
-
Validate outlier treatment on held-out data.
Part 3 - Evaluation Metrics
Which metrics would you use for classification and regression models?
What This Part Should Cover
-
Classification metrics may include accuracy, precision, recall, F1, PR-AUC, ROC-AUC, log loss, calibration, lift, and cost-weighted metrics.
-
Regression metrics may include MAE, RMSE, MAPE or sMAPE, R-squared, quantile loss, and residual diagnostics.
-
Explain metric pitfalls under imbalance, outliers, skewed targets, and business costs.
Part 4 - Algorithm and XGBoost Discussion
Pick one ML algorithm to explain step by step, and list important XGBoost hyperparameters if relevant.
What This Part Should Cover
-
Explain the chosen algorithm in a structured way from input features to training objective and prediction.
-
For XGBoost, cover learning rate, max depth, number of trees, subsampling, column sampling, regularization, min child weight, objective, and early stopping.
-
Tie hyperparameters to overfitting, speed, and generalization.
Follow-up Questions
-
How would you detect leakage from imputation?
-
What if missingness is highly predictive of the target?
-
How would you monitor missingness and outlier drift after deployment?