Skip to main content
QUICK REVIEW

[Paper Review] When to Impute? Imputation before and during cross-validation

Byron C. Jaeger, Nicholas Tierney|arXiv (Cornell University)|Oct 1, 2020
Statistical Methods and Bayesian InferenceMathematics13 references8 citations
TL;DR

This paper investigates whether imputing missing data before cross-validation (I→CV) introduces bias in generalization error estimation compared to imputing during each CV fold (CV∘→I). Despite a slight optimistic bias, I→CV reduces variance and yields lower overall root mean squared error for estimating external R², with minimal performance difference in tuned models, making it a computationally efficient and valid alternative in certain settings.

ABSTRACT

Cross-validation (CV) is a technique used to estimate generalization error for prediction models. For pipeline modeling algorithms (i.e. modeling procedures with multiple steps), it has been recommended the entire sequence of steps be carried out during each replicate of CV to mimic the application of the entire pipeline to an external testing set. While theoretically sound, following this recommendation can lead to high computational costs when a pipeline modeling algorithm includes computationally expensive operations, e.g. imputation of missing values. There is a general belief that unsupervised variable selection (i.e. ignoring the outcome) can be applied before conducting CV without incurring bias, but there is less consensus for unsupervised imputation of missing values. We empirically assessed whether conducting unsupervised imputation prior to CV would result in biased estimates of generalization error or result in poorly selected tuning parameters and thus degrade the external performance of downstream models. Results show that despite optimistic bias, the reduced variance of imputation before CV compared to imputation during each replicate of CV leads to a lower overall root mean squared error for estimation of the true external R-squared and the performance of models tuned using CV with imputation before versus during each replication is minimally different. In conclusion, unsupervised imputation before CV appears valid in certain settings and may be a helpful strategy that enables analysts to use more flexible imputation techniques without incurring high computational costs.

Motivation & Objective

  • To assess whether unsupervised imputation before cross-validation (I→CV) introduces bias in generalization error estimation compared to imputing during each CV fold (CV∘→I).
  • To investigate whether I→CV leads to poorly selected tuning parameters that degrade external model performance.
  • To evaluate the trade-off between computational cost and estimation accuracy in pipeline modeling with missing data.
  • To determine if I→CV is a valid and practical alternative to CV∘→I for imputation in machine learning pipelines.

Proposed method

  • The study compares two workflows: I→CV, where imputation is performed once before CV, and CV∘→I, where imputation is repeated within each CV fold.
  • The authors use both simulated data with varying missing data mechanisms (MCAR, MAR) and real data (Ames housing dataset) to evaluate performance.
  • Generalization error is estimated using external R², and model tuning is based on selecting the optimal number of nearest neighbors for imputation.
  • The ipa R package is introduced to facilitate single and multiple imputation for training and testing sets in predictive analytics.
  • Root mean squared error (RMSE) is used to compare the accuracy of generalization error estimates between I→CV and CV∘→I.
  • Statistical comparisons are made across different sample sizes and missing data scenarios to assess bias, variance, and overall estimation quality.

Experimental results

Research questions

  • RQ1Does imputing missing values before cross-validation (I→CV) lead to biased estimates of generalization error compared to imputing during each CV fold (CV∘→I)?
  • RQ2Does I→CV result in suboptimal tuning of model hyperparameters, such as the number of nearest neighbors for imputation, leading to poorer external model performance?
  • RQ3How do the bias and variance of generalization error estimates compare between I→CV and CV∘→I across different data scenarios and sample sizes?
  • RQ4What is the computational cost difference between I→CV and CV∘→I, and does this difference affect the practical feasibility of using CV∘→I?

Key findings

  • I→CV produces a slight but consistent optimistic bias in generalization error estimates compared to CV∘→I, though this bias is small in magnitude.
  • Despite the optimistic bias, I→CV yields lower overall root mean squared error (RMSE) for estimating the true external R² due to significantly reduced variance.
  • The performance of models tuned using I→CV is minimally different from those tuned using CV∘→I, indicating no degradation in external model performance.
  • In the Ames housing data, imputation time using CV∘→I is approximately 10 times higher than using I→CV, reflecting the computational burden of repeated imputation across folds.
  • For all scenarios, the optimal number of nearest neighbors selected via I→CV and CV∘→I consistently aligns, indicating equivalent tuning accuracy.
  • Overall, the mean external R² across all scenarios is 40.5% for I→CV and 37.8% for CV∘→I, with I→CV showing better balance between bias and variance.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.