I have prepared a recipe with only an imputation
rec<-recipe(DF_train) %>% update_role(all_numeric(),new_role = "predictor") %>%
step_impute_knn(all_numeric_predictors(),neighbors = 10)
I then prepared it using:
p_rec<-prep(rec)
However, when using bake(p_rec,new_data=DF1) the imputed values change when I change DF1 to e.g. DF2. It seems as if imputation is based on the new data (DF1, DF2 etc.) and not on the training data (DF_train). What am I missing??
Many thanks!! (also for an absolutely TERRIFIC package!)