The problem
I've found this problem you should probably be aware of:
Back in august 2021 I've created and saved a recipe with several steps, including the step_pca. I have been using the latest recipes package that was available at that time.
rec_obj <- recipe(~ ., data) %>%
update_role(username, new_role = "sample ID") %>%
step_YeoJohnson(all_predictors()) %>%
step_center(all_predictors()) %>%
step_scale(all_predictors()) %>%
step_pca(all_predictors(), threshold = 0.65)
trained_rec <- prep(rec_obj, training = data)
saveRDS(trained_rec, "models/trained_rec.rds")
Since then, I've been using this saved recipe in scoring process for several months without any issues. Last month I've upgraded to the latest recipes version 0.2.0 and scoring no longer works:
trained_rec <- readRDS("models/trained_rec.rds")
# baked data has the same number of variables as data, all steps except step_pca seem to be executed
baked_data <- bake(trained_rec, new_data = data)
If I print trained_rec , I get the following:
trained_rec
Recipe
Inputs:
role #variables
predictor 104
sample ID 1
Training data contained 29546 data points and no missing data.
Operations:
Yeo-Johnson transformation on ... [trained]
Centering for ... [trained]
Scaling for ... [trained]
No PCA components were extracted from <none> [trained]
PCA step has somehow been lost.
The solution
Downgrading the package version solves my problem:
require(devtools)
install_version("recipes", version = "0.1.17", repos = "http://cran.us.r-project.org")
Reproducible example
Sorry, but I can't (or don't know how to) write one since two versions of the recipe package are involved...
I'm using R version 4.0.4 on Windows.
The problem
I've found this problem you should probably be aware of:
Back in august 2021 I've created and saved a recipe with several steps, including the
step_pca. I have been using the latest recipes package that was available at that time.Since then, I've been using this saved recipe in scoring process for several months without any issues. Last month I've upgraded to the latest recipes version 0.2.0 and scoring no longer works:
If I print
trained_rec, I get the following:PCA step has somehow been lost.
The solution
Downgrading the package version solves my problem:
Reproducible example
Sorry, but I can't (or don't know how to) write one since two versions of the recipe package are involved...
I'm using R version 4.0.4 on Windows.