Step_impute_knn - ignore variable that should be imputed, instead of this impute value in all possible numeric variables:
prep(base_rec)
K-nearest neighbor imputation for Sepal.Width, Petal.Width, Species [trained]
whereas it should be only Petal.Length.
Bests
Seweryn
iris = as_tibble(iris)
iris[1, 1] <- as.numeric(NA)
iris[1, 2] <- as.numeric(NA)
iris[1 ,3] <- as.numeric(NA)
iris[1, 4] <- as.numeric(NA)
iris[1, 5] <- as.numeric(NA)
set.seed(123)
iris_split <- iris %>%
initial_split(strata = Sepal.Length)
iris_training <- training(iris_split)
iris_testing <- testing(iris_split)
iris_rf_model <- rand_forest(
mtry = 5,
min_n = 5,
trees = 500) %>%
set_engine("ranger") %>%
set_mode("regression")
base_rec <- recipe(Sepal.Length ~ .,
data = iris_training) %>%
step_impute_knn(Petal.Length)
prep(base_rec)
Step_impute_knn - ignore variable that should be imputed, instead of this impute value in all possible numeric variables:
prep(base_rec)
K-nearest neighbor imputation for Sepal.Width, Petal.Width, Species [trained]
whereas it should be only Petal.Length.
Bests
Seweryn