numeraire.WeightsOutput#

class numeraire.WeightsOutput(weights: DataFrame, realized: DataFrame, method: str, config_hash: str, data_vintage: str, run_id: str, capability: str = 'to_weights', meta: dict[str, ~typing.Any]=<factory>, missing_returns: Literal['error', 'zero', 'renormalize_legs']='error', horizon: int = 1)[source]#

Bases: object

OOS output for a to_weights method: target weights and aligned realized returns.

weights and realized are both (date x asset) indexed by the prediction dates, where realized.loc[t] is the return over (t, t+h] (so strategy_returns is the realized, no-look-ahead P&L of holding weights.loc[t] over that period). weights always remains the model’s target decision. If held returns are unavailable, missing_returns controls scoring and scoring_weights() exposes any ex-post effective weights separately.

__init__(weights: DataFrame, realized: DataFrame, method: str, config_hash: str, data_vintage: str, run_id: str, capability: str = 'to_weights', meta: dict[str, ~typing.Any]=<factory>, missing_returns: Literal['error', 'zero', 'renormalize_legs']='error', horizon: int = 1) None#

Methods

__init__(weights, realized, method, ...)

scoring_weights()

Effective ex-post weights used only to score returns under missing_returns.

strategy_returns()

Realized portfolio return per date under the explicit missing-return policy.

Attributes

capability

horizon

Effective forecast horizon h of the paired targets (steps of the decision calendar).

missing_returns

universe

Compact universe label (n=<#assets> for panels, the name for a single asset).

weights

realized

method

config_hash

data_vintage

run_id

meta

horizon: int = 1#

Effective forecast horizon h of the paired targets (steps of the decision calendar).

Populated by the drivers from the producing view; 1 is the default a direct construction keeps. realized.loc[t] is the return over (t, t+h], so an annualizing evaluator that reads it can tell a single-period target from an overlapping multi-period one.

property universe: str#

Compact universe label (n=<#assets> for panels, the name for a single asset).

scoring_weights() DataFrame[source]#

Effective ex-post weights used only to score returns under missing_returns.

Exposure, turnover, and plots should continue to consume weights, which is the untouched target decision. This method makes any missing-return adjustment auditable.

strategy_returns() Series[source]#

Realized portfolio return per date under the explicit missing-return policy.