modeltime_multifit: Fit Multiple Models to Multiple Time Series

Description Usage Arguments Details Value See Also Examples

View source: R/modeltime_multifit.R

Description

allows multiple models to be fitted over multiple time series, using models from the 'modeltime' package.

Usage

1
modeltime_multifit(serie, .prop, ...)

Arguments

serie

nested time series.

.prop

series train/test partition ratio.

...

models or workflows to train (model_1, model2, ...).

Details

the focus of this function is not related to panel series, it is oriented to multiple individual series. Receiving as the first argument "series" a set of nested series (for example through the nest() function), then specifying a desired train/test partition ratio for series. The final input to the function are the models to be trained, simply by typing the name of the models separated by commas. The function admits as many models as required.

Value

A list of 2 items. The first component is a tibble with a first column that contains the name of the series, and a second column called "nested_column" that stores the time series, then a column for each model where the trained models or workflows for each series are stored. The last 2 columns, "nested_model" and "calibration", store the "n" trained models for each series and the adjustment metrics on the test partition. The second element is a tibble saved with the name of 'models_accuracy', it allows to visualize the performance of each model for each series according to a set of metrics.

See Also

sknifedatar website

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
library(modeltime)
library(earth)
nested_serie <- 
tidyr::nest(dplyr::filter(sknifedatar::emae_series, date < '2007-02-01'),
            nested_column = -sector)

## Models
mars <- parsnip::mars(mode = 'regression') %>% parsnip::set_engine('earth')

# modeltime_multifit
sknifedatar::modeltime_multifit(serie = head(nested_serie,2),
                                .prop = 0.9,
                                mars)

sknifedatar documentation built on June 1, 2021, 9:08 a.m.