tune_grid {utsf} | R Documentation |
Estimate the forecast accuracy of a model on a time series according to a grid of parameters
Description
It uses an object of class utsf
to asses the forecasting accuracy of its
associated model on its associated time series applying rolling origin
evaluation according to different configurations of model parameters.
Usage
tune_grid(
model,
h,
tuneGrid,
type = c("normal", "minimum"),
size = NULL,
prop = NULL
)
Arguments
model |
An object of class |
h |
A positive integer. The forecasting horizon. |
tuneGrid |
A data frame with possible tuning values. The columns are named as the tuning parameters. |
type |
A string. Possible values are |
size |
An integer. It is the size of the test set (how many of the last
observations of the time series are used as test set). It can only be used
when the type parameter is |
prop |
A numeric value in the range (0, 1). It is the proportion of the
time series used as test set. It can only be used when the type parameter is
|
Details
The estimation of forecast accuracy is done with the efa()
function. The
best combination of parameters is used to train the model with all the
historical values of the time series and forecast h
values ahead.
Value
A list with three components:
tuneGrid |
A data frame with the different combination of parameters and the estimated forecast accuracy of a model trained with those parameters. |
best |
The best combination of parameters according to root mean squared error. |
forecast |
An
object of class |
Examples
m <- create_model(UKgas, lags = 1:4, method = "knn")
tune_grid(m, h = 4, tuneGrid = expand.grid(k = 1:7), type = "normal", size = 8)