Learn R Programming

healthyR.ts (version 0.3.1)

ts_wfs_lin_reg: Auto Linear Regression Workflowset Function

Description

This function is used to quickly create a workflowsets object.

Usage

ts_wfs_lin_reg(.model_type, .recipe_list, .penalty = 1, .mixture = 0.5)

Value

Returns a workflowsets object.

Arguments

.model_type

This is where you will set your engine. It uses parsnip::linear_reg() under the hood and can take one of the following:

  • "lm"

  • "glmnet"

  • "all_engines" - This will make a model spec for all available engines.

Not yet implemented are:

  • "stan"

  • "spark"

  • "keras"

.recipe_list

You must supply a list of recipes. list(rec_1, rec_2, ...)

.penalty

The penalty parameter of the glmnet. The default is 1

.mixture

The mixture parameter of the glmnet. The default is 0.5

Author

Steven P. Sanderson II, MPH

Details

This function expects to take in the recipes that you want to use in the modeling process. This is an automated workflow process. There are sensible defaults set for the glmnet model specification, but if you choose you can set them yourself if you have a good understanding of what they should be.

See Also

https://workflowsets.tidymodels.org/(workflowsets)

Other Auto Workflowsets: ts_wfs_arima_boost(), ts_wfs_auto_arima(), ts_wfs_ets_reg(), ts_wfs_mars(), ts_wfs_nnetar_reg(), ts_wfs_prophet_reg(), ts_wfs_svm_poly(), ts_wfs_svm_rbf(), ts_wfs_xgboost()

Examples

Run this code
suppressPackageStartupMessages(library(modeltime))
suppressPackageStartupMessages(library(timetk))
suppressPackageStartupMessages(library(dplyr))
suppressPackageStartupMessages(library(rsample))

data <- AirPassengers %>%
  ts_to_tbl() %>%
  select(-index)

splits <- time_series_split(
   data
  , date_col
  , assess = 12
  , skip = 3
  , cumulative = TRUE
)

rec_objs <- ts_auto_recipe(
 .data = training(splits)
 , .date_col = date_col
 , .pred_col = value
)

wf_sets <- ts_wfs_lin_reg("all_engines", rec_objs)
wf_sets

Run the code above in your browser using DataLab