Repository navigation
[FIX] Guard zero case reserve #1557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -345,3 +345,33 @@ def test_unweighted_ratios_preserved_when_n_periods_set(): | |
| assert np.allclose( | ||
| m.case_to_prior_case_.values, m_full.case_to_prior_case_.values, equal_nan=True | ||
| ) | ||
|
|
||
|
|
||
| def test_case_outstanding_zero_case_reserve_warning(): | ||
| import warnings | ||
|
|
||
| xyz = cl.load_sample("friedland_xyz_auto_bi") | ||
| with warnings.catch_warnings(): | ||
| warnings.filterwarnings("error", category=RuntimeWarning) | ||
| model = cl.CaseOutstanding( | ||
| paid_to_incurred=("Paid Claims", "Reported Claims") | ||
| ).fit(xyz) | ||
| assert model.paid_ldf_ is not None | ||
| assert not model.case_ldf_.to_frame().isna().any().any() | ||
|
|
||
|
|
||
| def test_case_outstanding_synthetic_zero_prior_case_warning(): | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use test fixture?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will do, I will pull the synthetic zero-case setup into a pytest fixture to keep the test body clean
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i meant the genins sample |
||
| import warnings | ||
|
|
||
| p = cl.load_sample("genins") | ||
| p.columns = ["paid"] | ||
| i = p.copy() | ||
| i.columns = ["incurred"] | ||
| i.values = p.values + 100 | ||
| # Force case to zero at earlier development maturity | ||
| i.values[..., 2] = p.values[..., 2] | ||
| tri = cl.concat((p, i), 1) | ||
| with warnings.catch_warnings(): | ||
| warnings.filterwarnings("error", category=RuntimeWarning) | ||
| m_zero = cl.CaseOutstanding(paid_to_incurred=("paid", "incurred")).fit(tri) | ||
| assert not m_zero.case_ldf_.to_frame().isna().any().any() | ||
Uh oh!
There was an error while loading. Please reload this page.