Description Usage Arguments Details Value Examples
Creates and returns a recipe object.
1 2 3 4 5 6 | createRecipe(
data = data,
responseVar = "response",
corrValue = 0.9,
otherValue = 0.01
)
|
data |
The training data set |
responseVar |
the variable that is the response for analysis. |
corrValue |
The value to remove variables that are highly correlated from dataset. The step will try to remove the minimum number of columns so that all the resulting absolute correlations are less than this value. Default value is .9. |
otherValue |
The minimum frequency of a level in a factor variable needed to avoid converting its outcome to "other". Default is .01. |
The following data transformations are automatically applied to the data:
Normalizes numeric variables
Puts infrequent levels of categorical variables into "other" category
Puts NA values into "unknown" category
Removes variables with near-zero variance
Removes highly correlated variables
One-hot encodes your categorical variables
If a different recipe is needed, I recommend calling the recipes library and building one appropriate for your dataset (this function is hard to automate given the variety of data transformations that can happen for a specific data set).
A recipes::recipe object that has been prepped.
1 2 3 4 5 6 7 8 | library(easytidymodels)
library(dplyr)
utils::data(penguins, package = "modeldata")
resp <- "sex"
split <- trainTestSplit(penguins, stratifyOnResponse = TRUE, responseVar = resp)
formula <- stats::as.formula(paste(resp, ".", sep="~"))
rec <- createRecipe(split$train, responseVar = resp)
rec
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.