knn imputation changes with a change in bake(new_data)

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!)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.