numeraire.backtest_forecast#

numeraire.backtest_forecast(estimator: Estimator, view: TimeSeriesView, *, min_train: int = 20, window: int | None = None, horizon: int | None = None, refit_every: int = 1, method: str, config: dict[str, Any] | None = None, data_vintage: str = 'unknown', run_id: str | None = None, n_jobs: int = 1) ForecastOutput[source]#

Walk-forward pseudo-OOS forecast (forecast-origin convention; GW2008 / 1-A / VoC).

At each origin t the model is fit on the window of data ending at and including t (rolling if window is given, else expanding from the start with min_train warm-up) and asked to forecast the return over (t, t+h]; the engine records the realized return and the window historical-mean benchmark. No look-ahead: the forecast uses only data <= t and the target is strictly future.

refit_every decouples the refit cadence from the prediction cadence (the ML-cross-section protocol: e.g. annual refits with monthly predictions = refit_every=12 on a monthly calendar): the model is re-fit on every refit_every-th origin and reused for the origins in between, whose forecasts still consume each origin’s own up-to-date PIT window (fresh features, stale parameters — never stale information). The benchmark stays the per-origin prevailing mean regardless. Include refit_every in config for provenance if you sweep it.

n_jobs fans the independent refit blocks over a thread pool (-1 = all cores); results are order-preserved, so the output is identical to n_jobs=1.