evaluate.results_to_dataframe()

Flatten backtest results into a tidy one-row-per-window DataFrame.

Usage

Source

evaluate.results_to_dataframe(results)

Columns are prefix-namespaced so metric, in-sample-metric, and parameter names never collide: window metrics become metric_<name>, in-sample metrics train_metric_<name>, and scalar parameters param_<name>, alongside the window indices t0/t1/t2, num_samples, and train_walltime/test_walltime. Forecast samples are excluded. Windows may carry different metric sets (e.g. via backtest(per_window_metrics=...)); the union of columns is used and missing entries are left as NaN.

A VectorizedBacktestResult from backtest_vectorized() is also accepted; it produces the same metric_<name> columns for the same metric set, but has no train_metric_*, param_*, or walltime columns (a vectorized run has no per-window walltimes), which are simply absent.

Parameters

results: Sequence[BacktestResult] | VectorizedBacktestResult
A sequence of BacktestResult from backtest(), or a single VectorizedBacktestResult from backtest_vectorized().

Returns

pandas.DataFrame
One row per window with the namespaced columns described above.

Raises

ImportError
If pandas is not installed (pip install numpyro_forecast[dataframes]).