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.
tune_grid(
model,
h,
tuneGrid,
type = c("normal", "minimum"),
size = NULL,
prop = NULL
)
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 utsf_forecast
with the forecast for horizon h
using the
best estimated combination of parameters.
An object of class utsf
with a model trained with a time
series.
A positive integer. The forecasting horizon.
A data frame with possible tuning values. The columns are named as the tuning parameters.
A string. Possible values are "normal"
(the default) and
"minimum"
. See the vignette utsf for an explanation of both ways
of evaluating forecast accuracy.
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 "normal"
. By default, it is the length of the
forecasting horizon.
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
"normal"
.
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.
m <- create_model(UKgas, lags = 1:4, method = "knn")
tune_grid(m, h = 4, tuneGrid = expand.grid(k = 1:7), type = "normal", size = 8)
Run the code above in your browser using DataLab