Skip to content

Friedland Chapter 11#1079

Open
henrydingliu wants to merge 6 commits into
mainfrom
experimental
Open

Friedland Chapter 11#1079
henrydingliu wants to merge 6 commits into
mainfrom
experimental

Conversation

@henrydingliu

@henrydingliu henrydingliu commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Summary of Changes

Adding a first draft of Chapter 11, which showcases the recently added TriangleWeight and DisposalRate

Unlike Chapter 6 and 7, we are using jupyter notebook, which provides richer formatting. Testing is achieved through asserts built into the notebook, though failing any assert only results in a warning.

Please go to experimental

Related GitHub Issue(s)

refers #588
closes #1073 #1024

Additional Context for Reviewers

other misc edits:

  • adding precision to several friedland datasets (use severity x count to get more decimals on loss)

    • adding precision to chapter 6 and 7 doctests as a result
  • removing friedland_xyz_disposal (redundant)

  • nan_triangle no longer returns full triangle for any pattern

  • w_ is now deleted inside _drop_subtriangles

  • TriangleWeight now supports full triangles

  • fit_OLS is fixed inside WeightedRegression; r-squared is added

  • I passed tests locally for both code (uv run pytest) and documentation changes (uv run jb build docs --builder=custom --custom-builder=doctest)


Note

Medium Risk
Touches triangle masking, weighted regression, and development weighting on projected triangles—areas that drive reserve math—but changes are backed by Friedland notebook asserts and new unit tests.

Overview
Adds Friedland Chapter 11 documentation (notebook + TOC) that walks frequency–severity exhibits using TriangleWeight, DisposalRate, WeightedRegression, and triangle arithmetic, with hardcoded assert checks against textbook figures.

Core behavior changes: TriangleWeight can apply n_periods (and related filters) on full triangles such as full_triangle_ via a new X.is_full weight path; _drop_subtriangles now clears attached w_. nan_triangle no longer treats pattern triangles like ultimates—only is_ultimate gets an all-ones mask. WeightedRegression uses weighted means in OLS and exposes rsq_.

Data & tests: Friedland sample CSVs gain precision and columns (e.g. Reported Claims on GL insurer); friedland_xyz_disp is removed from the manifest. Chapter 6/7 doctests and new TriangleWeight tests cover drop_valuation and full-triangle weight parity.

Reviewed by Cursor Bugbot for commit 44d0119. Bugbot is set up for automated code reviews on this repo. Configure here.

* WIP

* making progress

* promoting _param_property

* fixing bug

* full implementation w/ test

* bugbot and tests

* test fix

* rubric

* docstring and additional tests

* bugbot proof

* Update test_disposal.py

* docstring and additional tests

* bugbot proof

* Update test_disposal.py

* more bugbot fixes

* bug fix

* fix

* forcing numpy after all

* more fixes

* more fixes

* addressing reviewer comments

* added missing dependencies

* restructuring disposal attributes into mixin class

* adding `is_disposal_rate` attribute to triangle

* improving docstring and adding codecov coverage

* chapter 11 prep

* streamlining single dev weights

* doctest fixes

* additional tests
@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown

Pyright Type Completeness

View the full pyright --verifytypes output for this commit

Project (full chainladder package, at this PR's head): 14.7% of exported symbols fully typed (184 / 1255)

Known Ambiguous Unknown Total
Project (head) 184 106 965 1255

Other symbols referenced but not exported by chainladder: 13

Known Ambiguous Unknown Total
Other (head) 3 1 9 13

Symbols without documentation:

  • Functions without docstring: 313
  • Functions without default param: 0
  • Classes without docstring: 10

Patch (exported symbols added or changed by this PR): 0.0% fully typed (0 / 3)

Known Ambiguous Unknown Total
Patch 0 0 3 3
Patch symbol details
Symbol Status Change
chainladder.utils.tests.test_utilities.test_triangleweight_drop_valuation_all ❌ unknown new
chainladder.utils.tests.test_utilities.test_triangleweight_full_triangle ❌ unknown new
chainladder.utils.weighted_regression.WeightedRegression.rsq_ ❌ unknown new

@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.13%. Comparing base (55f9524) to head (44d0119).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1079      +/-   ##
==========================================
- Coverage   90.18%   90.13%   -0.06%     
==========================================
  Files          91       91              
  Lines        5409     5300     -109     
  Branches      696      673      -23     
==========================================
- Hits         4878     4777     -101     
+ Misses        375      369       -6     
+ Partials      156      154       -2     
Flag Coverage Δ
unittests 90.13% <100.00%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] nan_triangle returns full triangle when is_pattern

1 participant