liveBook · Manning

Supervised learning

As explained in Causal Inference for Data Science

Supervised learning is a machine-learning approach that learns a mapping from inputs to labeled outputs.

Supervised learning learns from historical input–output pairs to predict an outcome for a new input. Its central question is predictive: given x, what y is likely? Typical uses include forecasting sales, identifying spam, and prioritizing patients by their expected need for intensive care. section 4.0 section 4.1.1

Given data D = {(xᵢ, yᵢ)}, it selects a predictive function f so that f(x) estimates y. Inputs may be images, patient characteristics, or sales so far. When y is categorical, the task is classification; when y is continuous, it is regression. The model family can be linear models, decision trees, k-nearest neighbors, or deep learning models. section 4.1

Data fitting means choosing a function that predicts past observations well while aiming to generalize. Under square loss, the best prediction for inputs x₁, …, xₘ is the conditional expectation E[Y|x₁, …, xₘ]. For binary classification, this expectation equals P(Y = 1|x₁, …, xₘ). section 4.1.2

Prediction is not an intervention

A hospital can use age and existing health conditions to predict how soon a COVID-19 patient may need ICU care, then prioritize patients accordingly. That useful prediction does not answer which factors would reduce ICU admissions if changed. The same variables and model form can serve causal analysis, but causal analysis asks about the effects of actions rather than prediction accuracy alone. section 4.1.1

Figure 4.1 When to use causal inference or machine learning. Model input is denoted by X and the outcome by Y.
figure

Use the decision diagram to distinguish a model used to forecast an observed outcome from one used to decide what changing an input would cause. section 4.1.1

Reliable predictive use depends on limits that accuracy alone cannot settle:

  • Expect future cases to follow the same underlying dynamics as historical cases; the usual formal assumption treats past and future input–outcome pairs as independent and identically distributed. section 4.1.3
  • Be cautious when decisions based on predictions change the system itself. Interventions can shift the outcome distribution and make an originally useful predictor inaccurate. section 4.1.3
  • Check for spurious correlations. A dog-versus-fish classifier trained on dogs on grass and fish in water may learn background color rather than animal features, then fail on a dog against a blue background. section 4.3.3

Supervised learning can also support causal inference without becoming causal inference itself. In an adjustment formula, it can estimate conditional probabilities such as P(Y = y|X = x, Z = z), especially when many confounders make direct counting sparse. This plug-in use still requires causal assumptions about confounding; cross-validation alone is not enough to choose a causal model. section 4.2 section 4.6

Avoid training a flexible model and predicting on the same observations when its predictions will feed causal adjustment. The fitted model can mimic observed outcomes rather than the conditional expectation. Cross-fitting separates training and prediction folds to reduce this overfitting risk. section 4.2.5

How Causal Inference for Data Science covers it

How deep it goes
Defines training data, model families, classification, regression, conditional expectations, distribution assumptions, and cross-fitting cautions without deriving causal identification.
Examples
Uses sales forecasting, spam identification, COVID-19 ICU triage, and dog-versus-fish image classification to illustrate prediction and failure modes.
What it assumes
Assumes basic linear and logistic modeling, common machine-learning techniques, and cross-validation while reviewing foundational prediction concepts.
What you can do after
Evaluate/understand whether a predictive model fits a stable forecasting task or requires causal reasoning about interventions.
How it connects
Contrasts prediction with causal inference and connects to adjustment formulas, confounders, cross-validation, cross-fitting, and spurious correlations.

Also explained in

Compare how 19 books explain supervised learning →

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.