liveBook · Manning

Dataset split

As explained in Causal Inference for Data Science

A train-test split partitions observations into a training subset for fitting a model and a test subset for evaluating its predictions.

A dataset split separates observations into a train subset for fitting a model and a test subset for evaluating predictions on unseen data. The comparison helps distinguish learned signal from noise and reveals overfitting: a model that memorizes past data may perform poorly on future cases. section 4.1

Studying for an exam

Instead of studying every solved exam and risking memorization, set some exams aside, study the rest, and test yourself on the untouched subset. Likewise, fit the model on train data, predict the test outcomes, and compare predictions with what actually happened. The resulting error estimates future performance on new production data. section 4.1

Use the split as an evaluation safeguard, while keeping its limits in view:

  • Select the final model from candidate functions and configurations by minimizing error on the test set. section 4.1
  • Treat train-test splitting as a form of cross-validation, but do not assume cross-validation prevents every kind of overfitting. section 4.1 section 5.3.2
  • For propensity scores, use cross-fitting when predictions are calculated for the same historical patients used to construct the predictive models. section 5.3.2
  • Do not choose causal-inference variables solely because they improve predictive accuracy; domain knowledge should guide adjustment choices. section 5.3.2

How Causal Inference for Data Science covers it

How deep it goes
Defines train and test roles, describes prediction-error checking, and flags overfitting that ordinary cross-validation may not prevent.
Examples
Uses an exam-study analogy and license-plate recognition to contrast held-out evaluation with deployment data.
What it assumes
Assumes familiarity with predictive models and distinguishes predictive accuracy from causal variable selection.
What you can do after
Evaluate model performance by fitting on train data, predicting test outcomes, and comparing predictions with observed results.
How it connects
Connects supervised learning, overfitting, cross-validation, propensity scores, and cross-fitting.

Also explained in

Compare how 21 books explain dataset split →

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.