theil_u2 – Theil’s U2 inequality coefficient – ratio of forecast MSE to no-change MSE.#
Back to point_metrics axis | Back to L5 | Browse all options
Operational op under axis
point_metrics, sub-layerL5_A_metric_specification, layerl5. Standalone callable:mf.functions.theil_u2.
Function signature#
mf.functions.theil_u2(
y_true: np.ndarray | pd.Series,
y_pred: np.ndarray | pd.Series,
y_prev: np.ndarray | pd.Series,
) -> float
Parameters#
name |
type |
default |
constraint |
description |
|---|---|---|---|---|
|
`np.ndarray |
pd.Series` |
— |
— |
|
`np.ndarray |
pd.Series` |
— |
— |
|
`np.ndarray |
pd.Series` |
— |
— |
Returns#
float — scalar result.
Behavior#
Point-forecast metric theil_u2. U₂ = √(Σ (ŷ_t - y_t)² / Σ (y_{t-1} - y_t)²). U₂ < 1 means the forecast beats the random-walk benchmark. Standard sanity-check ratio in macro forecasting – if U₂ ≥ 1 the model is no better than ‘tomorrow looks like today’.
When to use
Sanity-checking against the random-walk benchmark; macro-forecasting tradition.
When NOT to use
When a custom benchmark (not random walk) is preferred – use relative_mse instead.
In recipe context#
Set params.point_metrics = "theil_u2" in the relevant layer to activate this op within a recipe:
# Layer L5 recipe fragment
params:
point_metrics: theil_u2
References#
macroforecast design Part 3, L5: ‘evaluation = (metric × benchmark × aggregation × decomposition × ranking).’
Theil (1966) ‘Applied Economic Forecasting’, North-Holland (Chapter 2: Inequality coefficients).