Choose a missing-value indicator
Return to the home row after each number or separator. · 174 words
A missing-value indicator is an extra column that records whether a value was absent before you filled it in. The usual code is 1 for missing and 0 for observed. Imagine a museum visitor survey with columns visitor_id, age, and age_missing. Four records are (1, 34, 0), (2, blank, 1), (3, 42, 0), and (4, blank, 1). Filling each blank age with the observed median, 38, gives ages 34, 38, 42, and 38. The new indicator still shows which two ages were estimated rather than recorded.
This matters because an imputed number can hide uncertainty. At a library, 3 of 6 customers have no recorded visit date. Fill those dates with the median, but keep date_missing values 1,1,1,0,0,0. The model can then learn that incomplete records behave differently, something a filled date cannot show. Keep the indicator when missingness may reflect how data was collected. If being missing is unrelated to the target, the indicator may only add noise. Compare models with and without it on validation data, never on the final test set.
Check your recall
In the museum survey, what does age_missing equal for visitor 2, and why should it remain after the missing age is filled with 38?
Check your answer
It equals 1 because visitor 2's age was originally missing. Keeping the indicator distinguishes the estimated age from an age that was actually recorded.
Sources and credits
Original KeyTouch lesson. Background reading · Google · Machine Learning Crash Course.