Description Usage Arguments Details Value
Time-series cross-validation
1 2 3 4 5 | ts_crossval(y, func, ..., initial_window, horizon = 1, fixed_window = TRUE,
skip_slice = 0, slices = create_cv_timeslices(y, initial_window =
initial_window, horizon = horizon, fixed_window = fixed_window, skip =
skip_slice), error_func = rmse, break_err = Inf, break_err_batch = Inf,
break_batch_size = NA, plapply = NULL, verbose = FALSE)
|
y |
The time-series |
func |
Forecasting function. See details. |
... |
Forcasting function parameters. |
initial_window |
initial number of consecutive values in each training set sample |
horizon |
forecat horizon in cross-validation. Number of consecutive values in test set sample |
fixed_window |
if TRUE, training window size is fixed to |
skip_slice |
How many slices are to be skip_sliceped and not used for cross-validation. |
slices |
Cross-validation slices |
error_func |
Error function for reporting cross-validation error. |
break_err |
If CV error exceeds this value, cross-validation is prematurely stopped. See details. |
break_err_batch |
If CV error in each batch exceeds this value, cross-validation is prematurely stopped. See details. |
break_batch_size |
Batch size for |
plapply |
Parallel processing apply function for each batch. |
verbose |
If True, verbose debugging messages are printed out. |
func
expects function signature function(y, h, ...)
, where y
is the time-series to forecast,
h
is the horizon to forecast, and ...
is any other parameter.
error_func
expects function signature function(x, y)
, where x
and y
are both
time-series. It should return a number, which must be accumulative.
Use break_err
when you have to evaluate many functions quickly.
By setting this value to CV from a known good predictor, bad forecasters can be pruned quickly.
This value is only effective is break_batch_size
is given.
plapply
is used to parallelize execution of func
.
If break_batch_size
is given, slices are divided to batches, and given to plapply
.
This will be used in conjunction with break_err
and break_err_batch
,
as parallel processing apply functions are often designed to run continously and
do not allow their results to be checked before all of the computation is done.
break_err_batch
is specifically used to break the cross-validation operation
if the error in the current batch exceeds the given threshold.
Cross-validation error for the given forecast function
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.