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
Situation
You must impute predictors, and the same dataset serves both a coefficient-interpretation study and a model to be deployed for scoring.
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.
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.
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
Flexible Imputation of Missing Data section 6.3.2 advises including all variables of the complete-data model, outcome included, in the imputation model, noting that leaving them out tends to bias results toward zero.