As steps are estimated by
prep, these operations are
applied to the training set. Rather than running
to duplicate this processing, this function will return
variables from the processed training set.
One or more selector functions to choose which variables will be
returned by the function. See
Either "tibble", "matrix", "data.frame", or "dgCMatrix" for the format of the processed data set. Note that all computations during the baking process are done in a non-sparse format. Also, note that this argument should be called after any selectors and the selectors should only resolve to numeric columns (otherwise an error is thrown).
When preparing a recipe, if the training data set is
retain = TRUE, there is no need to
recipe to get the preprocessed training set.
juice will return the results of a recipes where all steps
have been applied to the data, irrespective of the value of
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
library(modeldata) data(biomass) biomass_tr <- biomass[biomass$dataset == "Training",] biomass_te <- biomass[biomass$dataset == "Testing",] rec <- recipe(HHV ~ carbon + hydrogen + oxygen + nitrogen + sulfur, data = biomass_tr) sp_signed <- rec %>% step_normalize(all_predictors()) %>% step_spatialsign(all_predictors()) sp_signed_trained <- prep(sp_signed, training = biomass_tr) tr_values <- bake(sp_signed_trained, new_data = biomass_tr, all_predictors()) og_values <- juice(sp_signed_trained, all_predictors()) all.equal(tr_values, og_values)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.