liveBook · Manning

Overfitting

As explained in Causal Inference for Data Science

Overfitting is the condition in which a model captures noise or idiosyncrasies in training data and consequently generalizes poorly to new data.

Overfitting occurs when a model learns noise or peculiarities in training data so closely that it predicts new data poorly. Flexible function families can fit the past extremely well while failing to distinguish signal from noise. The central question is whether a model that predicts the past will also predict the future. section 4.1

Studying from solved exams

Memorizing every solved exam can produce excellent performance on familiar questions without demonstrating understanding. Setting some exams aside, studying the remainder, and testing on unseen exams estimates performance on the final exam. Train-test splitting applies the same idea: fit the model on train data and evaluate predictions against known outcomes in test data. section 4.1

Check for overfitting by separating ordinary model selection from prediction on unseen observations:

  • Use cross-validation or train-test splitting to compare model configurations on data not used for fitting. section 4.1
  • Do not assume cross-validation alone prevents overfitting when predictions are later made on the same dataset used for training. section 4.2.5
  • Use cross-fitting when a causal procedure requires predictions for the observations used in the overall analysis: train on one fold and predict on another. section 4.2.5 section 4.6
  • Select causal adjustment variables using domain knowledge rather than choosing every variable that improves predictive accuracy. section 5.3.2
Comparing models with varying complexity in data fitting. Although the model on the left fits the data more closely (it passes through all points), the model on the right can get the full picture better.
sidebar figure

Compare a highly flexible curve that passes through every observed point with a simpler model that captures the broader pattern. section 4.2.5

In supervised learning, the target is the conditional expectation E[Y|X], not the individual observed value yi. Training on the same observations encourages predictions toward those observed values, especially with complex models. In causal inference, this distinction matters for S-learners, T-learners, propensity scores, and adjustment formulas. section 4.2.5 section 4.6

How Causal Inference for Data Science covers it

How deep it goes
Explains flexibility, noise, conditional expectation, train-test splitting, cross-validation, and cross-fitting, while stopping short of model-specific algorithms.
Examples
Uses a solved-exam analogy, train-test prediction, varying-complexity fits, license-plate recognition, and two-fold causal learners.
What it assumes
Assumes familiarity with supervised learning and introduces the distinction between observed outcomes and conditional expectations.
What you can do after
Diagnose overfitting with held-out evaluation and apply cross-fitting when causal predictions target observations used in analysis.
How it connects
Connects supervised learning, cross-validation, cross-fitting, causal inference, propensity scores, S-learners, and T-learners.

Also explained in

Compare how 24 books explain overfitting →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Causal Inference for Data Science. The section links point to the parts of the book it draws on.