liveBook · Manning

Missing value

As explained in Grokking AI Algorithms, Second Edition

A missing value is an absent or unrecorded value for an attribute in a data record.

A missing value is an absent or unrecorded value for an attribute in a data record. In machine-learning data, missing values make examples harder to compare and can cause problems for algorithms. section 8.8

Table 8.2 The diamond dataset with missing and inconsistent data

Carat

Cut

Color

Clarity

Depth

Table

Price

X

Y

Z

1

0.30

Good

J

SI1

64.0

55

339

4.25

4.28

2.73

2

0.41

Ideal

I

si1

61.7

55

561

4.77

4.80

2.95

3

0.75

Very good

D

SI1

63.2

56

2,760

5.80

5.75

3.65

4

0.91

–

H

SI2

–

60

2,763

6.03

5.99

3.95

5

1.20

Fair

F

I1

64.6

56

2,809

6.73

6.66

4.33

6

1.21

Good

E

I1

57.2

62

3,144

7.01

6.96

3.99

7

1.31

Premium

J

SI2

59.7

59

3,697

7.06

7.01

4.20

8

1.50

Premium

H

I1

62.9

60

4,022

7.31

7.22

4.57

9

1.74

Very good

H

i1

63.2

55

4,677

7.62

7.59

4.80

10

1.83

fair

J

I1

70.0

58

5,083

7.34

7.28

5.12

11

1.96

Fair

I

I1

66.8

55

6,147

7.62

7.60

5.08

12

–

Premium

H

i1

62.2

–

6,535

8.31

–

5.16

The diamond dataset shows missing Cut and Depth values in one example and missing Carat, Table, and Y values in another. section 8.8

Common ways to handle missing values include:

  • Remove examples containing missing features. This avoids making assumptions, but may discard records important to the task. section 8.8
  • Replace numeric missing values with a feature’s mean or median. The mean is efficient but ignores feature relationships and does not suit categorical features. section 8.8
  • Estimate a missing value from related features when a meaningful relationship exists, such as using diamond dimensions for a missing measurement. section 8.13 section 8.9

A diamond record with missing data

Suppose a record lacks Cut and Depth. Removing the record preserves observed values but reduces the dataset. Replacing numeric values with a mean or median may preserve the record, while the categorical Cut value needs another treatment or estimation. section 8.8 section 8.9

How Grokking AI Algorithms, Second Edition covers it

How deep it goes
Explains removal, mean or median replacement, and relationship-based estimation, but stops short of implementation details.
Examples
Uses a diamond dataset containing missing Cut, Depth, Carat, Table, Y, X, and Z values.
What it assumes
Assumes basic familiarity with dataset rows and features while defining mean, median, and categorical features in context.
What you can do after
Apply removal, summary-value replacement, or feature-based estimation when preparing data for machine learning.
How it connects
Connects missing values with data cleaning, categorical data, feature relationships, and model accuracy.

Also explained in

Compare how 35 books explain missing value →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking AI Algorithms, Second Edition. The section links point to the parts of the book it draws on.