View source: R/preprocess_functions.R
preprocess_functions | R Documentation |
Examples of preprocess functions that can be used in
cross_validate_fn()
and
validate_fn()
.
They can either be used directly or be starting points.
The examples use recipes
,
but you can also use caret::preProcess()
or
similar functions.
In these examples, the preprocessing will only affect the numeric predictors.
You may prefer to hardcode a formula like "y ~ ."
(where
y
is your dependent variable) as that will allow you to set
'preprocess_one' to TRUE
in cross_validate_fn()
and validate_fn()
and save time.
preprocess_functions(name)
name |
Name of preprocessing function as it appears in the following list:
|
A function with the following form:
function(train_data, test_data, formula, hyperparameters) {
# Preprocess train_data and test_data
# Return a list with the preprocessed datasets
# and optionally a data frame with preprocessing parameters
list(
"train" = train_data,
"test" = test_data,
"parameters" = tidy_parameters
)
}
Ludvig Renbo Olsen, r-pkgs@ludvigolsen.dk
Other example functions:
model_functions()
,
predict_functions()
,
update_hyperparameters()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.