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/tests/test_triangle.py
Original file line number Diff line number Diff line change
Expand Up @@ -2355,7 +2355,7 @@ def test_friedland_gl_self_insurer_grain() -> None:
)


def test_OXDX_triangle():
def test_oxdx_triangle():

for x in [12, 6, 3, 1]:
for y in [i for i in [12, 6, 3, 1] if i <= x]:
Expand Down
43 changes: 25 additions & 18 deletions chainladder/development/tests/test_incremental.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,38 @@ def test_schmidt():
answer = ia_transform.incremental_.incr_to_cum().values[0, 0, :, -1]
answer_zeta = ia_transform.zeta_.values[0, 0, 0, :]
answer_cum_zeta = ia_transform.cum_zeta_.values[0, 0, 0, :]
check = xp.array(
[
3483.0,
4007.84795031,
4654.36196862,
5492.00685523,
6198.10197128,
7152.82539296,
]
)
check_zeta = xp.array(
[0.24321225, 0.22196026, 0.15397836, 0.14185271, 0.09067327, 0.03677019]
)
check_cum_zeta = xp.array(
[0.88844704, 0.64523479, 0.42327453, 0.26929617, 0.12744346, 0.03677019]
)
check = xp.array([
3483.0,
4007.84795031,
4654.36196862,
5492.00685523,
6198.10197128,
7152.82539296,
])
check_zeta = xp.array([
0.24321225,
0.22196026,
0.15397836,
0.14185271,
0.09067327,
0.03677019,
])
check_cum_zeta = xp.array([
0.88844704,
0.64523479,
0.42327453,
0.26929617,
0.12744346,
0.03677019,
])
assert (
xp.allclose(answer, check, atol=1e-5)
& xp.allclose(answer_zeta, check_zeta, atol=1e-8)
& xp.allclose(answer_cum_zeta, check_cum_zeta, atol=1e-8)
)


def test_IBNR_methods():
def test_ibnr_methods():
tri = cl.load_sample("ia_sample")
incr_est = cl.IncrementalAdditive().fit(
tri["loss"], sample_weight=tri["exposure"].latest_diagonal
Expand All @@ -54,7 +62,6 @@ def test_IBNR_methods():

def test_pipeline():
clrd = cl.load_sample("clrd").groupby("LOB")[["IncurLoss", "CumPaidLoss"]].sum()
dev = cl.Development().fit_transform(clrd)
ult = cl.Chainladder().fit(clrd)
with pytest.warns(UserWarning, match="exclusions have been ignored"):
dev1 = cl.IncrementalAdditive(
Expand Down
17 changes: 10 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ preview = true
extend-exclude = ["docs/getting_started/online_sandbox/sandbox_workbook_blank.ipynb"]

[tool.ruff.lint]
select = ["E2", "E4", "E7", "E9", "F", "B018", "UP034"]
select = ["E2", "E4", "E7", "E9", "F", "B018", "UP034", "N802"]

# Grandfathered violations that predate enabling this rule set. New and
# newly-touched code is still held to the full ruleset above; these files
Expand All @@ -119,18 +119,20 @@ select = ["E2", "E4", "E7", "E9", "F", "B018", "UP034"]
"chainladder/adjustments/tests/test_berqsherm.py" = ["F841"]
"chainladder/adjustments/tests/test_disposal.py" = ["E226", "E231", "E241", "E251", "E265", "F841"]
"chainladder/adjustments/trend.py" = ["F401"]
"chainladder/core/correlation.py" = ["E741"]
"chainladder/core/correlation.py" = ["E741", "N802"]
"chainladder/core/slice.py" = ["E225"]
"chainladder/core/tests/rtest_correlation.py" = ["E266", "E722", "F821"]
"chainladder/core/tests/test_arithmetic.py" = ["E222", "E225", "E226", "E711"]
"chainladder/core/tests/test_display.py" = ["E722"]
"chainladder/core/tests/test_grain.py" = ["E265", "F401", "F841"]
"chainladder/core/tests/test_slicing.py" = ["E203", "E225"]
"chainladder/development/barnzehn.py" = ["E201", "E202", "E231", "E251", "E275"]
"chainladder/development/clark.py" = ["N802"]
"chainladder/development/constant.py" = ["E712"]
"chainladder/development/glm.py" = ["E225", "E231", "E251", "F401"]
"chainladder/development/incremental.py" = ["E226", "E231", "E251", "E265", "E721", "F401", "UP034"]
"chainladder/development/learning.py" = ["E225", "E226", "E231", "E265", "E711", "F401"]
"chainladder/development/learning.py" = ["E225", "E226", "E231", "E265", "E711", "F401", "N802"]
"chainladder/development/munich.py" = ["N802"]
"chainladder/development/tests/rtest_clark.py" = ["E266", "E722"]
"chainladder/development/tests/rtest_development.py" = ["E266", "E722", "F401"]
"chainladder/development/tests/rtest_munich.py" = ["E266", "E722", "F401"]
Expand All @@ -139,7 +141,7 @@ select = ["E2", "E4", "E7", "E9", "F", "B018", "UP034"]
"chainladder/development/tests/test_development.py" = ["B018", "E231", "E251", "E265", "E722"]
"chainladder/development/tests/test_glm.py" = ["E225", "E226", "E231"]
"chainladder/development/tests/test_incremental.py" = ["F841"]
"chainladder/methods/base.py" = ["E231", "F401"]
"chainladder/methods/base.py" = ["E231", "F401", "N802"]
"chainladder/methods/capecod.py" = ["F401"]
"chainladder/methods/mack.py" = ["E265", "F401"]
"chainladder/methods/tests/rtest_mack.py" = ["E266", "E722", "F401"]
Expand All @@ -154,16 +156,17 @@ select = ["E2", "E4", "E7", "E9", "F", "B018", "UP034"]
"chainladder/utils/cupy.py" = ["E722", "F401"]
"chainladder/utils/dask.py" = ["E722", "E741"]
"chainladder/utils/sparse.py" = ["E231", "E251", "E721"]
"chainladder/utils/tests/test_sparse.py" = ["E231", "E251"]
"chainladder/utils/tests/test_sparse.py" = ["E231", "E251", "N802"]
"chainladder/utils/tests/test_utilities.py" = ["E225", "E231", "E712", "E741", "F811", "F841"]
"chainladder/utils/triangle_weight.py" = ["E227", "E231", "E265", "F401"]
"chainladder/utils/utility_functions.py" = ["E226", "E227", "E231", "E251", "E252", "E721", "F401"]
"chainladder/utils/weighted_regression.py" = ["E227", "E231", "E252"]
"chainladder/utils/utility_functions.py" = ["E226", "E227", "E231", "E251", "E252", "E721", "F401", "N802"]
"chainladder/utils/weighted_regression.py" = ["E227", "E231", "E252", "N802"]
"chainladder/workflow/tests/test_voting.py" = ["E231", "E731", "UP034"]
"chainladder/workflow/tests/test_workflow.py" = ["E203", "E241"]
"chainladder/workflow/voting.py" = ["E231", "E252", "E265"]
".github/scripts/pytest_parallel.py" = ["E241", "E702"]
"docs/friedland/chapter_10.ipynb" = ["E731", "F841"]
"docs/friedland/chapter_7_part_2.ipynb" = ["N802"]
"docs/friedland/chapter_9.ipynb" = ["E731"]
"docs/gallery/plot_advanced_triangle.ipynb" = ["E225"]
"docs/gallery/plot_ave_analysis.ipynb" = ["E203", "E225"]
Expand Down
Loading