Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion chainladder/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ def _drop_subtriangles(self):
del self.sigma_
if "std_err_" in sub_tris:
del self.std_err_
#w_ is currently stored as an ndarray
# w_ is currently stored as an ndarray
if hasattr(self, "w_"):
del self.w_

Expand Down
11 changes: 10 additions & 1 deletion chainladder/utils/data/_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,16 @@
"origin": "Accident Year",
"development": "Calendar Year",
"index": None,
"columns": ["Paid Claims", "Reported Claims", "Closed Claim Counts", "Reported Claim Counts", "Case Outstanding", "Reported Severities", "Earned Premium","Incremental Paid Severity"],
"columns": [
"Paid Claims",
"Reported Claims",
"Closed Claim Counts",
"Reported Claim Counts",
"Case Outstanding",
"Reported Severities",
"Earned Premium",
"Incremental Paid Severity"
],
"cumulative": True,
},
"genins": {
Expand Down
14 changes: 6 additions & 8 deletions chainladder/utils/tests/test_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from chainladder import (
__dt64_unit__
)
from chainladder.utils.utility_functions import date_delta_adjustment
from chainladder.utils.data._manifest import SAMPLES
from chainladder.utils.utility_functions import (
date_delta_adjustment,
Expand Down Expand Up @@ -59,7 +58,6 @@


def test_triangle_json_io(clrd):
xp = clrd.get_array_module()
clrd2 = cl.read_json(clrd.to_json(), array_backend=clrd.array_backend)
assert clrd == clrd2
assert np.all(clrd.kdims == clrd2.kdims)
Expand Down Expand Up @@ -153,7 +151,7 @@
)


def test_model_diagnostics_erorr(raa,atol):
def test_model_diagnostics_erorr(raa, atol):
with pytest.raises(ValueError):
cl.model_diagnostics(raa)
dev = cl.Development().fit_transform(raa)
Expand All @@ -162,7 +160,7 @@
md = cl.model_diagnostics(est)
assert np.allclose(
md['Run Off 1'].values,
emerg[emerg.valuation.year==1991].latest_diagonal.values,
emerg[emerg.valuation.year == 1991].latest_diagonal.values,
atol=atol,
equal_nan=True
)
Expand All @@ -186,18 +184,18 @@
)


def test_model_diagnostics_groupby(prism,atol):
def test_model_diagnostics_groupby(prism, atol):
dev = cl.Development().fit(prism["Incurred"].sum())
est = cl.Chainladder().fit(dev.transform(prism["Incurred"]))
lhs = cl.model_diagnostics(est,groupby=['Line'])
lhs = cl.model_diagnostics(est, groupby=['Line'])
rhs = cl.model_diagnostics(cl.Chainladder().fit(dev.transform(prism["Incurred"].groupby('Line').sum())))
assert np.allclose(lhs['Ultimate'].values,rhs['Ultimate'].values,atol=atol,equal_nan=True)
assert np.allclose(np.nan_to_num(lhs['IBNR'].values),np.nan_to_num(rhs['IBNR'].values),atol=atol,equal_nan=True)
assert np.allclose(lhs['Ultimate'].values,rhs['Ultimate'].values,atol=atol, equal_nan=True)

Check failure on line 192 in chainladder/utils/tests/test_utilities.py

View workflow job for this annotation

GitHub Actions / ruff check

ruff (missing-whitespace)

chainladder/utils/tests/test_utilities.py:192:69: missing-whitespace: Missing whitespace after `,` help: Add missing whitespace

Check failure on line 192 in chainladder/utils/tests/test_utilities.py

View workflow job for this annotation

GitHub Actions / ruff check

ruff (missing-whitespace)

chainladder/utils/tests/test_utilities.py:192:46: missing-whitespace: Missing whitespace after `,` help: Add missing whitespace
assert np.allclose(np.nan_to_num(lhs['IBNR'].values),np.nan_to_num(rhs['IBNR'].values),atol=atol, equal_nan=True)

Check failure on line 193 in chainladder/utils/tests/test_utilities.py

View workflow job for this annotation

GitHub Actions / ruff check

ruff (missing-whitespace)

chainladder/utils/tests/test_utilities.py:193:91: missing-whitespace: Missing whitespace after `,` help: Add missing whitespace

Check failure on line 193 in chainladder/utils/tests/test_utilities.py

View workflow job for this annotation

GitHub Actions / ruff check

ruff (missing-whitespace)

chainladder/utils/tests/test_utilities.py:193:57: missing-whitespace: Missing whitespace after `,` help: Add missing whitespace


def test_concat_immutability(raa):
u = cl.Chainladder().fit(raa).ultimate_
l = raa.latest_diagonal

Check failure on line 198 in chainladder/utils/tests/test_utilities.py

View workflow job for this annotation

GitHub Actions / ruff check

ruff (ambiguous-variable-name)

chainladder/utils/tests/test_utilities.py:198:5: ambiguous-variable-name: Ambiguous variable name: `l`
u.columns = l.columns
u_new = copy.deepcopy(u)
cl.concat((l, u), axis=3)
Expand Down Expand Up @@ -682,7 +680,7 @@
"""
options = cl.Options()
assert options.ARRAY_BACKEND == "numpy"
assert options.AUTO_SPARSE == True

Check failure on line 683 in chainladder/utils/tests/test_utilities.py

View workflow job for this annotation

GitHub Actions / ruff check

ruff (true-false-comparison)

chainladder/utils/tests/test_utilities.py:683:12: true-false-comparison: Avoid equality comparisons to `True`; use `options.AUTO_SPARSE:` for truth checks help: Replace with `options.AUTO_SPARSE`
assert options.ARRAY_PRIORITY == ["dask", "sparse", "cupy", "numpy"]
assert isinstance(options.ULT_VAL, str)

Expand Down Expand Up @@ -1273,5 +1271,5 @@
Testing new path that allows weights on full triangles
'''
ult = cl.Chainladder().fit(raa)
tw = cl.TriangleWeight(n_periods = 4).fit(raa)

Check failure on line 1274 in chainladder/utils/tests/test_utilities.py

View workflow job for this annotation

GitHub Actions / ruff check

ruff (unexpected-spaces-around-keyword-parameter-equals)

chainladder/utils/tests/test_utilities.py:1274:39: unexpected-spaces-around-keyword-parameter-equals: Unexpected spaces around keyword / parameter equals help: Remove whitespace

Check failure on line 1274 in chainladder/utils/tests/test_utilities.py

View workflow job for this annotation

GitHub Actions / ruff check

ruff (unexpected-spaces-around-keyword-parameter-equals)

chainladder/utils/tests/test_utilities.py:1274:37: unexpected-spaces-around-keyword-parameter-equals: Unexpected spaces around keyword / parameter equals help: Remove whitespace
tw_full = cl.TriangleWeight(n_periods = 4).fit(ult.full_triangle_)

Check failure on line 1275 in chainladder/utils/tests/test_utilities.py

View workflow job for this annotation

GitHub Actions / ruff check

ruff (unexpected-spaces-around-keyword-parameter-equals)

chainladder/utils/tests/test_utilities.py:1275:44: unexpected-spaces-around-keyword-parameter-equals: Unexpected spaces around keyword / parameter equals help: Remove whitespace

Check failure on line 1275 in chainladder/utils/tests/test_utilities.py

View workflow job for this annotation

GitHub Actions / ruff check

ruff (unexpected-spaces-around-keyword-parameter-equals)

chainladder/utils/tests/test_utilities.py:1275:42: unexpected-spaces-around-keyword-parameter-equals: Unexpected spaces around keyword / parameter equals help: Remove whitespace
Expand Down
Loading