Rolling-origin evaluation for time-aware Gaussian processes
Source:R/gp-time-series.R
rolling_origin_gp.RdPerforms expanding-window rolling-origin evaluation with fixed kernel and noise hyperparameters. Each split is fitted using only observations available at that origin, preventing look-ahead leakage.
Usage
rolling_origin_gp(
time,
y,
kernel,
initial_window,
horizon = 1L,
step = 1L,
noise_variance = 1e-06,
mean = zero_mean(),
unit = "auto",
interval_level = 0.95,
...
)Arguments
- time
Numeric, Date, or POSIXt vector in strictly increasing order.
- y
Numeric response vector.
- kernel
Fixed Gaussian-process kernel specification.
- initial_window
Number of observations in the first training window.
- horizon
Number of future observations predicted at each origin.
- step
Number of observations between consecutive origins.
- noise_variance
Non-negative observation-noise variance: a scalar, or one value per observation. With one value per observation, each training window uses the values of its rows and each forecast uses the values of its target rows.
- mean
Gaussian-process mean specification.
- unit
Time unit passed to
gp_time_index().- interval_level
Probability level for prediction intervals.
- ...
Additional arguments passed to
fit_time_series_gp(), such asmethod = "state_space".
Details
Fixed hyperparameters prevent future observations from influencing earlier origins through repeated whole-series hyperparameter tuning. Hyperparameters can be selected separately using an appropriate training period.
Stability
Stable: from version 1.0.0 this interface changes incompatibly only in a major release, after a deprecation period. Results and options that concern an experimental model class, kernel, or argument follow that interface's tier. See gaussianprocesses-package for the policy.
Examples
time <- 0:23
y <- sin(2 * pi * time / 12)
backtest <- rolling_origin_gp(
time,
y,
kernel = time_series_kernel(period = 12),
initial_window = 12,
horizon = 3,
step = 3,
noise_variance = 0.05
)
head(backtest[, c("origin_index", "horizon", "observed", "mean", "covered")])
#> Gaussian-process rolling-origin backtest
#> forecasts: 6
#> origins: 2
#> maximum horizon: 3