Skip to content
ML Academy

Feature engineering and preprocessing · insight-1110

Include the outcome when imputing for an inferential model and leave it out of a deployed imputer

Evidence type
documented fact
Difficulty
hard
Roles
Data scientist
Industries
healthcare, cross-industry

Summary: situation, action, reason, boundary

  1. Situation

    You must impute predictors, and the same dataset serves both a coefficient-interpretation study and a model to be deployed for scoring.

  2. Action

    For the inferential analysis, multiply impute with the outcome and all analysis variables in the imputation model; for deployment, fit the imputer on predictors only, inside the training pipeline.

  3. Reason

    Imputed predictors must be consistent with the model later applied, which includes the outcome; at serving the outcome is unknown, so the imputer cannot depend on it.

  4. Boundary

    Studies reporting effects and models that share a cleaned dataset.

Symptom or risk

An imputation model without the outcome biases effect estimates toward zero, while a deployed imputer that uses the outcome cannot run at scoring time.

Exceptions

Purely predictive projects that never interpret coefficients need only the deployable imputer.

Trade-offs

Two imputation workflows to maintain and explain.

Pitfalls

Reusing the inference-time imputed dataset to evaluate the deployable model, which leaks the label into the predictors.

Lessons and concepts

Claims and their sources