الانتقال إلى المحتوى
Machine LearningSupervised Learning· 6 دقائق للقراءة

Predictive Isn't Causal: Why a Model Can't Tell You What to Change

A feature can predict the outcome perfectly well and still do nothing when you change it.

ReadIn

مقال كل يوم يفرق معاك

22 نوفمبر 2026
  • كاتب موثّق
محتويات المقال

In the mid-1990s, a large project trained models to predict which pneumonia patients were likely to die, so high-risk patients could be admitted and low-risk ones treated as outpatients. One model, a set of readable rules, learned "has asthma ⇒ lower risk". As Caruana and colleagues recount, the pattern was real in the data: asthmatic pneumonia patients were usually admitted straight to intensive care, and that aggressive care worked. Used to decide who goes to hospital, the rule would have sent home the very patients who, untreated, face much higher risk. The prediction was right; the action it suggested was dangerous.

The common misconception

"If a feature strongly predicts the outcome, changing that feature will change the outcome." Careful people slip into it for understandable reasons:

  • Coefficients and feature importances read like effect sizes: "each year of education adds this much an hour."
  • Dashboards call top features "drivers" of churn or revenue, and the word sticks.
  • A model that scores well on held-out data feels like it has captured how the world works.

The half-truth: sometimes the predictive link is the causal one, for example when the feature was assigned at random. But a model can't tell that case from the others. It is built to find associations that hold under the conditions it was trained in, and a decision changes those conditions.

What actually happens

Prediction and intervention are two different questions. "Which users will stay?" asks what goes with what in the data you have. "Will users stay if we turn on notifications?" asks about a world you haven't observed yet: the same users, with one thing changed by you.

A confounder makes a bystander look like a driver

A is a variable that affects both the feature and the outcome. scikit-learn's causal interpretation example simulates wages that depend on a college degree, experience, parents' wages and ability. Ability also raises the chance of getting a degree, and in practice nobody measures it. Fit a linear model without ability, and the model inflates the degree coefficient to make up for the missing variable: omitted-variable bias. Rerun the example and the coefficient climbs from 2.0, its true value, to 3.0. Read that as "what a degree is worth" and you overstate it by half.

Accuracy can't warn you

In that example, the model with ability scores an R² of 0.975 on test data, and the model without it 0.968. Nearly the same accuracy, very different stories about the degree. The predictions are fine either way, because the degree really does go together with higher wages. Only the causal reading is wrong.

A what-if on the model is still a prediction

Here is the same trap in a product team. Engaged users both turn on notifications and stick around; notifications themselves help only a little. The first script trains a model on logged data, including a session count that partly reflects engagement, then asks it what happens if everyone, or no one, has notifications on. The second script runs the experiment instead: a coin decides who gets notifications.

Python
import numpy as npfrom scipy.special import expit  # the logistic functionfrom sklearn.linear_model import LogisticRegressionrng = np.random.default_rng(0)n = 20_000engaged = rng.normal(size=n)               # what really drives retentionsessions = engaged + rng.normal(size=n)    # a noisy, logged trace of itnotify = engaged + rng.normal(size=n) > 0  # engaged users opt instays = rng.random(n) < expit(2 * engaged + 0.3 * notify)  # small real effectX = np.column_stack([notify, sessions])model = LogisticRegression().fit(X, stays)on, off = X.copy(), X.copy()on[:, 0], off[:, 0] = 1, 0  # "what if everyone / no one had notifications?"lift = (model.predict_proba(on)[:, 1] - model.predict_proba(off)[:, 1]).mean()print(f"Model's what-if: notifications add {lift:+.3f} to retention")# Model's what-if: notifications add +0.265 to retention

The model's what-if promises 26.5 points of retention; the true effect is 4.5 points, and the measures 4.2. Including sessions didn't save the model: a noisy trace of engagement only removes part of the confounding. Flipping a column in predict_proba doesn't simulate an intervention; it asks the model about users who look like they have notifications on, and in the logged data those are the engaged ones. The coin breaks that link: engaged and casual users land in both groups alike, so any difference left is the notifications.

Importance describes the model, not the world

Coefficients, permutation importance and similar tools explain the model. scikit-learn's permutation importance guide says the score reflects how important a feature is for a particular model, not its intrinsic value. Its coefficient example adds that any conclusion is about the model you built, not about the real process that generated the data.

Predictive questionCausal question
ExampleWhich users will churn next month?Will notifications reduce churn?
What it needsAn association that holds under current conditionsThe effect of changing one thing
EvidenceAccuracy on held-out dataA randomized experiment, or stated causal assumptions
ConfoundersHelpful: they improve predictionsThe main threat
AnswerA score for each rowA difference between two worlds

How to apply it in your project

  1. Name the question firstWrite down whether the goal is to predict an outcome or to choose an action. "Who will churn?" and "what reduces churn?" need different evidence.
  2. Use experiments for causal questionsWhen you can randomize, run an A/B test. Randomization handles confounders you didn't measure and don't even know about.
  3. State your assumptions when you can'tWithout an experiment, list the confounders you believe exist and whether you measured them. scikit-learn's example points to methods such as instrumental variables for this case; bring in someone who knows them.
  4. Report importances as reliance, not influenceWrite "the model relies on sessions", never "sessions drive retention". The first is what the tools measure.
  5. Watch the model after acting on itIf your model's decisions change who gets treated, monitor it on fresh data, and keep the random holdout running.

Key takeaways

  • A feature that predicts an outcome may only travel with its real cause; changing it can do far less than the model implies.
  • Accuracy doesn't reveal confounding: in scikit-learn's example, test R² was 0.975 with the confounder and 0.968 without it.
  • Flipping a feature in predict_proba is still a prediction: here it claimed +0.265, while the A/B test measured +0.042.
  • Answer causal questions with randomized experiments or explicit causal assumptions, and keep a random holdout when a model drives actions.

📚 المصادر

  1. Failure of Machine Learning to infer causal effects — scikit-learn examples
  2. Common pitfalls in the interpretation of coefficients of linear models — scikit-learn examples
  3. Permutation feature importance — scikit-learn User Guide
  4. Intelligible Models for HealthCare: Predicting Pneumonia Risk and Hospital 30-day Readmission — Caruana et al., KDD 2015 (PDF)

التعليقات (0)