Machine Learning, FoundationsLesson 24 of 92

Module 3 · The data is the job

Missing values, and the information in the gap

In this lesson

  • 9 min read
  • 6 reading sections
  • Knowledge check
  • Lesson 5 of 12 in this chapter

This chapter’s goalTake a raw table with mixed types, missing values, high-cardinality categories, dates and free text, and produce a fitted preprocessing pipeline that leaks nothing from the held-out data, handles categories unseen at training time, and whose every transformation you can justify by what the downstream model requires.

This chapter’s media

The film explains chapter ideas. The audiobook narrates the complete teaching text.

FormatEnglishहिंदी
Chapter filmWatch1:44Not available
Full audiobookNot availableNot available
Three reasons a value is missingMissing completely at randomA sensor dropped packets. Nothing about the rowdecides it. Dropping rows is safe here, and onlyhere. Rare.Missing at random, given what you sawYounger applicants skip the income field, but amongapplicants of one age the gap says nothing aboutincome. Impute from the other columns.Missing not at randomVery high and very low incomes go unstated. Theinformation needed to fill the gap is exactly whatis absent. No imputation recovers it; the indicatorcarries the signal.The data cannot tell you which of these you have; whoever collected the rows can. In every case thefirst move is the same: add the indicator column, then impute, or let boosted trees learn a directionfor NaN themselves.
The data cannot tell you which of these you have; whoever collected the rows can. In every case the first move is the same: add the indicator column, then impute, or let boosted trees learn a direction for NaN themselves.

Figure

A little at a time

Explore an idea, try it, then check what stays.

Step 1 of 8Free · no account needed
Lesson steps

Why it is missing changes what to do

Three situations, with consequences that differ enough to be worth the vocabulary.

Missing completely at random. A sensor dropped packets. Nothing about the row determines whether the value is there. Rare in practice, and the only case where dropping rows is safe.

Missing at random, given what you observed. Income is missing more often for younger applicants, but among applicants of the same age, whether income is recorded has nothing to do with the income itself. Imputation using the other columns is principled here.

Missing not at random. The value is missing because of what it is. People with very high or very low incomes decline to state them. Patients who felt fine did not return for the follow-up test. Here no imputation can recover the truth, because the information needed to reconstruct it is exactly what is absent.

Your place and first choices stay on this browser. Classroom credit is recorded separately.

Every lesson here is open. Your progress is recorded once you pass the How a Language Model Actually Works exam.

Stuck on something?Ask Funke, your AI tutor

How to cite: Addaly (2026) ‘Missing values, and the information in the gap’, in Machine Learning, Foundations. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/machine-learning-foundations/missing-values (Accessed: 29 November 2026).