Developer Tools for preparing XREGS (Regressors)
These functions are designed to assist developers in extending the modeltime
package. create_xregs_recipe()
makes it simple to automate conversion
of raw un-encoded features to machine-learning ready features.
create_xreg_recipe( data, prepare = TRUE, clean_names = TRUE, dummy_encode = TRUE, one_hot = FALSE )
data |
A data frame |
prepare |
Whether or not to run |
clean_names |
Uses |
dummy_encode |
Should |
one_hot |
If |
The default recipe contains steps to:
Remove date features
Clean the column names removing spaces and bad characters
Convert ordered factors to regular factors
Convert factors to dummy variables
Remove any variables that have zero variance
A recipe
in either prepared or un-prepared format.
library(dplyr) library(timetk) library(recipes) library(lubridate) predictors <- m4_monthly %>% filter(id == "M750") %>% select(-value) %>% mutate(month = month(date, label = TRUE)) predictors # Create default recipe xreg_recipe_spec <- create_xreg_recipe(predictors, prepare = TRUE) # Extracts the preprocessed training data from the recipe (used in your fit function) juice_xreg_recipe(xreg_recipe_spec) # Applies the prepared recipe to new data (used in your predict function) bake_xreg_recipe(xreg_recipe_spec, new_data = predictors)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.