liveBook · Manning

MissingIndicator

As explained in Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI

MissingIndicator is a scikit-learn transformer that creates binary features indicating missing values.

MissingIndicator creates binary features that record whether values are missing. These indicators preserve information when absence itself may reveal how data was generated or predict an outcome. section 2.2.4 section 2.4.2

Treat missingness as a signal when:

  • A relational join leaves unmatched records, making absence evidence of a missing database match. section 2.2.4
  • A respondent skips a census question because the answer feels socially unacceptable, making nonresponse potentially informative. section 2.2.4
  • A feature contains enough missing values that its missingness pattern could help prediction. section 2.4.2

Inspecting Auto MPG missingness

Before creating indicators, inspect missing counts with pandas isna(). In the Auto MPG data, mpg has 8 missing cases and horsepower has 6. MissingIndicator can preserve those patterns as binary features, while the model pipeline still applies an appropriate missing-value treatment when required. section 2.4.2

(data.isna()
    .sum(axis=0)         
)                   

Review the column-wise missing-value count used to identify features whose missingness may warrant indicator variables. section 2.4.2

How Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI covers it

How deep it goes
Defines the indicator’s purpose and motivates it with practical cases, but defers detailed API usage and implementation.
Examples
Uses relational joins, socially influenced census nonresponse, and Auto MPG missing counts as examples.
What it assumes
Assumes basic tabular features and missing values, then teaches their predictive significance through isna() inspection.
What you can do after
Apply it via scikit-learn to preserve missingness patterns while selecting an algorithm-appropriate missing-value treatment.
How it connects
Connects missingness indicators with imputation, IterativeImputer, neural networks, generalized linear models, and gradient boosting.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI. The section links point to the parts of the book it draws on.