Tune hyperparameters of an Echo State Network (ESN) based on
time series cross-validation (i.e., rolling forecast). The input series is
split into n_split expanding-window train/test sets with test size
n_ahead. For each split and each hyperparameter combination
(alpha, rho, tau) an ESN is trained via train_esn() and
forecasts are generated via forecast_esn().
Arguments
- y
Numeric vector containing the response variable.
- n_ahead
Integer value. The number of periods for forecasting (i.e. forecast horizon).
- n_split
Integer value. The number of rolling train/test splits.
- alpha
Numeric vector. The candidate leakage rates (smoothing parameters).
- rho
Numeric vector. The candidate spectral radii.
- tau
Numeric vector. The candidate reservoir scaling values.
- min_train
Integer value. Minimum training sample size for the first split.
- ...
Further arguments passed to
train_esn().
Value
An object of class "tune_esn" (a list) with:
pars: Atibblewith one row per hyperparameter combination and split. Columns includealpha,rho,tau,split,train_start,train_end,test_start,test_end,mse,mae, andid.fcst: A numeric matrix of point forecasts withnrow(fcst) == nrow(pars)andncol(fcst) == n_ahead.actual: The original input seriesy(numeric vector), returned for convenience.
See also
Other base functions:
forecast_esn(),
is.esn(),
is.forecast_esn(),
is.tune_esn(),
plot.esn(),
plot.forecast_esn(),
plot.tune_esn(),
print.esn(),
summary.esn(),
summary.tune_esn(),
train_esn()
Examples
xdata <- as.numeric(AirPassengers)
fit <- tune_esn(
y = xdata,
n_ahead = 12,
n_split = 5,
alpha = c(0.5, 1),
rho = c(1.0),
tau = c(0.4),
inf_crit = "bic"
)
fit$pars
#> # A tibble: 10 × 11
#> alpha rho tau split train_start train_end test_start test_end mse mae
#> <dbl> <dbl> <dbl> <int> <int> <int> <int> <int> <dbl> <dbl>
#> 1 0.5 1 0.4 1 1 84 85 96 769. 22.3
#> 2 0.5 1 0.4 2 1 96 97 108 1267. 28.3
#> 3 0.5 1 0.4 3 1 108 109 120 1276. 31.0
#> 4 0.5 1 0.4 4 1 120 121 132 1035. 24.3
#> 5 0.5 1 0.4 5 1 132 133 144 1038. 23.9
#> 6 1 1 0.4 1 1 84 85 96 471. 19.5
#> 7 1 1 0.4 2 1 96 97 108 376. 14.2
#> 8 1 1 0.4 3 1 108 109 120 526. 19.0
#> 9 1 1 0.4 4 1 120 121 132 547. 20.2
#> 10 1 1 0.4 5 1 132 133 144 396. 17.0
#> # ℹ 1 more variable: id <int>
