ts_crossval: Time-series cross-validation

Description Usage Arguments Details Value

Description

Time-series cross-validation

Usage

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)

Arguments

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 initial_window. If FALSE, all available data from the start until testing point is used.

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 break_err_batch and plapply. See details

plapply

Parallel processing apply function for each batch. lapply by default. See details.

verbose

If True, verbose debugging messages are printed out.

Details

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.

Value

Cross-validation error for the given forecast function


fnoorian/mltsp documentation built on May 16, 2019, 1:48 p.m.