3
$\begingroup$

Der community

I have a question about the appropriate handling of the imputation of missing data to get an unbiased estimate of prediction accuracy during model building and assessment. While statistical modelling has a wealth of theoretical and practical information about missing data, there is less available for prediction modelling/machine learning. I want to build a prediction model and I am unsure how to handle the outcome observations Y during the model building/validation and testing procedure.

If I impute missing data among the predictors in the training data set using (for example) knn, I would develop the imputation model using X and Y in the training data set before I start identifying the best hyper parameters to develop a prediction model. I would use the imputation model to impute missing data in the validation data set to identify the best hyperparameters using cross-validation.

Would I include the outcome observations (Y) or would I remove the outcomes and treat them as missing to simulate a real-life situation? The same questions apply to the assessment of the final model in the hold-out test data set (or in the outer loop of nested cross-validation)?

I wonder if I can keep the outcome observations (Y) in the hyperparameter tuning step (validation data set) because my model performance will be only assessed in the hold-out/test data set, and including the outcome in the validation data set may improve the prediction model. However, I would not use the outcome in the final test data set (for internal validation)?

$\endgroup$

1 Answer 1

2
$\begingroup$

Imputing the target variable in validation and test (especially the test) sets is not a good idea. With the test set, we look for real world performance evaluation; and the better your data resembles real data, the higher your chances of getting a more realistic performance measure before you deploy your model. Slightly less critical, but validation set should also mimic your test data, so better to exclude it for target imputation.

$\endgroup$
3
  • $\begingroup$ Thank you, unfortunately, my question was not precise. My question referred to data that are missing among the predictor. I will edit my question. $\endgroup$
    – Steely
    Commented Jun 6, 2022 at 13:26
  • $\begingroup$ Sorry I've misunderstood your question. Can you elaborate on your question in the OP: "Would I include the Y variable or would I remove the outcomes and treat them as missing to simulate a real-life situation?"? Do you mean using imputing missing values in the features of validation set using the features and target of training set? $\endgroup$
    – gunes
    Commented Jun 6, 2022 at 13:35
  • 1
    $\begingroup$ Thanks for keeping interested. I clarified my question, esp. about my use of outcome variable, outcome and Y and added more information about the use of the imnputation model: I want to develop an imputation model using the training data set (followed by developing a prediction model using hyper parameter tuning) and to use this imputation model to predict missing values in the feature variables. My question is when do I include the observed outcomes in the imputation process. $\endgroup$
    – Steely
    Commented Jun 6, 2022 at 14:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.