numeraire.backtest#
- numeraire.backtest(estimator: Estimator, view: Any, splitter: Any = None, *, method: str, in_sample: bool = False, **kwargs: Any) WeightsOutput | ForecastOutput | PricingOutput | PanelWeightsOutput[source]#
Backtest
estimatoroverview, dispatching to the right typed driver by capability.The discoverable entry point over the typed drivers. It routes on two things:
which capability the fitted model advertises —
capabilities()intersected with{to_weights, to_forecast, to_pricing};the view type —
TimeSeriesViewvsCrossSectionView.
Dispatch rule (capability + view -> driver -> Output):
to_weights+TimeSeriesView->backtest_weights()->WeightsOutputto_weights+CrossSectionView->backtest_panel()->PanelWeightsOutputto_forecast+TimeSeriesView->backtest_forecast()->ForecastOutputto_pricing(either view) ->backtest_pricing()->PricingOutputto_pricing+in_sample=True->backtest_pricing_in_sample()->PricingOutput
in_sample=Trueselects the single-full-sample-fit pricing path (explanatory in-sample R^2) and requires ato_pricingmodel. Every other path is walk-forward.To read the capabilities the model must first be fitted, so
backtestdoes one inspection fit on the full ``view`` and then delegates to the driver (which re-fits per fold / on the full sample as its discipline requires). The extra fit is intentional and cheap relative to a full walk-forward; power users who want to skip it — or who need the precise return type — can call the typed driver (backtest_weights/backtest_forecast/backtest_panel/backtest_pricing/backtest_pricing_in_sample) directly.A model advertising more than one of the three dispatchable capabilities is ambiguous and raises
TypeError— call the specific typed driver in that case. Extra keyword arguments (min_train,window,refit_every,config,data_vintage,run_id,n_jobs, …) are forwarded to the selected driver.