varimpact icon indicating copy to clipboard operation
varimpact copied to clipboard

Error in knn imputation

Open ck37 opened this issue 7 years ago • 1 comments

There seems to be an error with knn imputation when a row has multiple missing values (possibly all missing values or all except 1 missing values). We may need an na.rm somewhere, and/or we may want to change the default imputation back to median.

ck37 avatar Dec 14 '17 01:12 ck37

The error appears to be in the predict() via caret:

data.numW = predict(impute_info, data.num)

Error in FUN(newX[, i], ...) : cannot impute when all predictors are missing in the new data point

Perhaps we can catch the error via try() and then fall back to imputation to the median just for those rows.

ck37 avatar Dec 14 '17 01:12 ck37