Skip to main content

evaluate.VectorizedBacktestResult

Result of a backtest_vectorized() run (all windows at once).

Usage

Source

evaluate.VectorizedBacktestResult(
    t0, t1, t2, num_samples, losses, metrics, predictions=None
)

Unlike BacktestResult this holds every window’s values stacked along a leading window axis, because the windows are fitted, drawn, and scored in single vmapped passes rather than one call each. There are no per-window walltimes (a single fused computation covers all windows).

Attributes

t0, t1, t2

Train-begin, train/test split, and test-end time indices, each an integer array of shape (num_windows,).

num_samples: int

Number of forecast samples drawn per window.

losses: Array

SVI loss history with shape (num_windows, num_steps).

metrics: dict[str, Array]

Mapping of metric name to a (num_windows,) array of per-window values.

predictions: Array | None
Stacked out-of-sample forecast samples with shape (num_windows, num_samples, *batch, test_window, obs), or None unless keep_predictions=True.

Methods

Name Description
to_dict() Return a flat dictionary view.

to_dict()

Return a flat dictionary view.

Usage

Source

to_dict()

The view does not copy the arrays: predictions, losses and the window indices are the same objects as on the result. The metrics mapping is a shallow copy, so adding or replacing entries of the returned dictionary (or of that mapping) never changes the result. Use copy.deepcopy(result.to_dict()) for an independent copy of the arrays.

Returns
dict[str, Any]
All fields as a plain dictionary.