numeraire.comparison#
Within-capability comparison harness — score several methods on one common set of test assets.
The long-deferred comparison item, crystallized for the pricing capability: a cross-sectional
asset-pricing comparison (Fama-French / GRS tradition), where competing models are judged by how
well they price one shared panel of test assets. Each entry brings its own training
view — a factor-model estimator may train on a characteristic panel (a CrossSectionView), an
SDF or three-pass estimator on a returns block (a TimeSeriesView) — but every model’s expected
returns are scored against the same canonical realized-return panel, so the numbers are comparable.
The wrinkle a common panel creates: a representation-hungry model (e.g. one driven by
characteristics) needs its own view of those same test assets to price them. An entry therefore
may carry a test_view — same calendar and asset labels as test_assets, possibly a different
view type — that its fitted model prices. compare() verifies that alignment and always pulls
realized returns from the canonical test_assets panel, never from a model’s own view.
This module is core-adjacent infrastructure (it lives in numeraire proper, imports only
numeraire.core + numpy/pandas, and is exempt from the boundary rule’s method/adapter ban like
numeraire.testing). compare is a single full-sample-fit, in-sample comparison (every row
is tagged protocol="in_sample"); for out-of-sample per-method scoring, run
numeraire.core.engine.backtest_pricing() on each method directly. The signature is kept
capability-generic (entries + a common test set + a list of evaluators); v1 implements the pricing
capability.
Score every entry's expected returns on one common test-asset panel; return tidy result rows. |
|
One competitor in a comparison: a named estimator, its training view, its test-asset view. |