How do you handle missing data in a dataset?
Instruction: Explain median imputation for a numeric prediction feature using a small example. Give one advantage, two limitations, and the correct training/validation order.
Updated
Official answer
For a prediction baseline, one simple method is median imputation for a numeric feature. If the observed training values are 10, 20, 30, their median is 20; a missing value is replaced by 20. Fit the imputer using only training data, within each training fold during cross-validation. Apply that fitted value to validation and future data rather than recomputing it from them.
This method is cheap, easy to explain and less sensitive than mean imputation to extreme observed values. It keeps rows available for the model. Its limits matter: it creates an artificial concentration at the median, can distort relationships, and does not represent uncertainty about the missing value. Compare it with appropriate alternatives on the actual prediction task.
First distinguish missing values from valid zeros, quantify missingness by feature and relevant groups, and investigate how the data were collected. Observed patterns alone generally cannot prove that missingness is at random or rule out dependence on an unobserved value. Predicting a missingness indicator from observed features does not by itself fix missing-not-at-random bias.
For terminology, complete-case deletion removes rows with missing required values. Pairwise deletion uses the available observations for each particular calculation; it does not mean deleting features. For estimation or inference, an imputation method and uncertainty calculation need assumptions appropriate to that target, not just a good predictive score.
Assessment: A strong answer explains both the benefit and limitation of one method, fits it without test-data leakage, and avoids treating a filled-in value as an observed fact.
Sources
Related Questions
-
easy
-
easy
-
easy
-
medium
-
medium