A risk carries the model's index date for its member
Risk and risk_rows give (pac_id, fecha_indice, horizonte_anios, probabilidad, ic_bajo, ic_alto), the shape a batch now stores: the horizons count from the model's index date, taken from the estimate's rows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HmQxVJVNR5FYkPAregGEQ7
This commit is contained in:
@@ -66,11 +66,13 @@ def _stored():
|
||||
|
||||
|
||||
def test_each_row_becomes_one_risk_at_its_horizon():
|
||||
"""Pins down: a risk is `(pac_id, horizonte_anios, probabilidad, None, None)`, one per member and horizon, the
|
||||
horizon taken from the row. Fails if the horizon is dropped, taken from elsewhere, or the interval is filled with
|
||||
"""Pins down: a risk is `(pac_id, fecha_indice, horizonte_anios, probabilidad, None, None)`, one per member and
|
||||
horizon, the index date and the horizon taken from the row. Fails if the horizon is dropped, taken from elsewhere, or the interval is filled with
|
||||
something the model didn't give."""
|
||||
d1, d2 = date(2025, 1, 1), date(2025, 1, 2)
|
||||
assert risk_rows(_estimate((1, 2), horizons=(0.0, 3.0))) == [
|
||||
(1, 0.0, 0.1, None, None), (1, 3.0, 0.13, None, None), (2, 0.0, 0.2, None, None), (2, 3.0, 0.23, None, None)]
|
||||
(1, d1, 0.0, 0.1, None, None), (1, d1, 3.0, 0.13, None, None), (2, d2, 0.0, 0.2, None, None),
|
||||
(2, d2, 3.0, 0.23, None, None)]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("frame", [_estimate((1, 1)), _estimate().assign(probabilidad=[0.1, 1.5, 0.2]),
|
||||
|
||||
Reference in New Issue
Block a user