Skip to content

[FEAT] IncrementalAdditive Cleanup for Chapter 16 Part 1 - #1419

Open
henrydingliu wants to merge 14 commits into
casact:mainfrom
henrydingliu:feature/friedland_chapter_16_prep_2
Open

henrydingliu wants to merge 14 commits into
casact:mainfrom
henrydingliu:feature/friedland_chapter_16_prep_2

Conversation

@henrydingliu

@henrydingliu henrydingliu commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

Summary of Changes

More clean-up and bug fix as I work through Chapter 16

  • Cleaning up zeta_-related properties into IncrementalMixin, matching DisposalMixin
  • fixed a bug in cum_to_incr for cum_zeta_, w/ new test to guard future drift; also improved readability of the surrounding code
  • refactored _param_property across modules to condense the universal properties to DevelopmentBase and keep module-specific properties at module level
  • other docstring improvements

Related GitHub Issue(s)

#588
#377

AI/LLM Usage

AI did some autofill of docstrings, which I then validated edited

Additional Context for Reviewers

zeta_ still shows the wrong development labels. will address after #1304

Submitter's Checklist

  • I have reviewed and am adhering to the standards outlined in the project Governing Doc.
  • The PR subject title summarizes the changes, with one proper prefix ([FIX], [FEAT], [DOCS], [TST], [CHORE], or [BRK]).
  • I am a human (not a bot), and this PR form is written by a human.

Reviewer's Checklist

  • The implementation addresses the associated issue(s).
  • The implementation is appropriate, maintainable, and follows ARCHITECTURE.md.
  • PR subject title has the proper prefix and the subject is appropriate.
  • Relevant issue(s) are linked.
  • AI/LLM usage is disclosed and appropriate.
  • Documentation and tests are appropriate.
  • CI tests passed, or any failures are acceptable.
  • Leave a comment with the final recommendation (e.g. approve as is, request a secondary review, or flag an area for more review).

Note

Medium Risk
Changes triangle incr/cum conversion and how fitted development parameters are tagged, which can affect incremental additive and pattern-based workflows; mitigated by targeted tests.

Overview
Incremental additive (zeta_) handling is aligned with the disposal mixin pattern: a new IncrementalMixin on TriangleBase exposes zeta_ / cum_zeta_ with setters that stamp pattern flags (is_pattern, is_additive, is_cumulative), stores values on _zeta_, and has_zeta now keys off that private attribute. cum_zeta_ is removed from the shared Common mixin in favor of the incremental mixin API.

Parameter triangles are refactored so DevelopmentBase._param_property only sets shared pattern metadata; Development, IncrementalAdditive, and disposal estimators override it for type-specific flags (multiplicative LDF vs additive zeta_ vs disposal rates). Development.fit no longer stacks regression outputs into one array with an index—each statistic gets its own _param_property call.

incr_to_cum / cum_to_incr on Triangle are rewritten with explicit branches for multiplicative LDF patterns, additive factor patterns (is_additive), normal increments, and disposal rates, plus a dedicated is_additive property. This fixes incorrect incremental conversion for cumulative additive (cum_zeta_) patterns.

Tests cover setting cum_zeta_, missing zeta_ errors, and updated has_zeta / _param_property call sites.

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

@github-actions

github-actions Bot commented Sep 21, 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): 15.1% of exported symbols fully typed (209 / 1387)

Known Ambiguous Unknown Total
Project (head) 209 111 1067 1387

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: 327
  • Functions without default param: 0
  • Classes without docstring: 10

Patch (exported symbols added or changed by this PR): 33.3% fully typed (2 / 6); 1 no longer exported

Known Ambiguous Unknown Total
Patch 2 0 4 6
Patch symbol details
Symbol Status Change
chainladder.core.triangle.Triangle.is_additive ✅ known new
chainladder.development.incremental.IncrementalMixin ❌ unknown new
chainladder.development.incremental.IncrementalMixin.cum_zeta_ ❌ unknown new
chainladder.development.incremental.IncrementalMixin.zeta_ ❌ unknown new
chainladder.development.tests.test_incremental.test_no_zeta ❌ unknown new
chainladder.development.tests.test_incremental.test_setting_cum ✅ known new
chainladder.core.common.Common.cum_zeta_ — no longer exported (was ❌ unknown)

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread chainladder/core/triangle.py
@codecov

codecov Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.95%. Comparing base (d82c521) to head (4b3e652).
⚠️ Report is 119 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1419      +/-   ##
==========================================
+ Coverage   91.79%   92.95%   +1.16%     
==========================================
  Files          96      102       +6     
  Lines        5494     6092     +598     
  Branches      707      771      +64     
==========================================
+ Hits         5043     5663     +620     
+ Misses        327      310      -17     
+ Partials      124      119       -5     
Flag Coverage Δ
unittests 92.95% <100.00%> (+1.16%) ⬆️

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.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread chainladder/core/triangle.py

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread chainladder/core/triangle.py Outdated
@henrydingliu henrydingliu changed the title [FEAT] IncrementalAdditive Cleanup for Chapter 16 [FEAT] IncrementalAdditive Cleanup for Chapter 16 Part 1 Sep 21, 2026
@henrydingliu
henrydingliu marked this pull request as ready for review September 21, 2026 17:44

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread chainladder/core/triangle.py Outdated
@henrydingliu

Copy link
Copy Markdown
Member Author

@genedan just assigned this to you as i'd like this to land so i can continue working on chapter 16.

@genedan

genedan commented Oct 12, 2026

Copy link
Copy Markdown
Member

I'm working my way through the open PRs bottom up, so this one is next.

@henrydingliu

Copy link
Copy Markdown
Member Author

I'm working my way through the open PRs bottom up, so this one is next.

thanks. the series of #840 PRs are lower prio than #1455 and #1480

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d7a983e. Configure here.

Comment thread chainladder/development/base.py
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.

2 participants