Disposal#1021
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 40f977f. Configure here.
| """ | ||
| return self.fit(X, y, sample_weight).transform(X, sample_weight=sample_weight) | ||
| def _test(self, X, ult): | ||
| return 'test' No newline at end of file |
There was a problem hiding this comment.
Debug stub left in class
Low Severity
The new DisposalRate class ends with a _test method that ignores its arguments and always returns the string 'test'. Nothing in the repository calls it, so it looks like leftover scaffolding rather than part of the public API.
Reviewed by Cursor Bugbot for commit 40f977f. Configure here.
| X_new.incr_disposal_ = self.incr_disposal_ | ||
| X_new.ultimate_ = sample_weight.latest_diagonal | ||
| ibnr_pct = 1 - X_new.disposal_.align_pattern(X_new.disposal_rate_tri) | ||
| run_off = X_new.incr_disposal_ / ibnr_pct * X_new.ibnr_ |
There was a problem hiding this comment.
Zero divisor in runoff scaling
Medium Severity
In transform, future runoff is computed as incr_disposal_ / ibnr_pct * ibnr_. Where cumulative disposal already reaches 100% (ibnr_pct is zero) or ibnr_ is zero, division yields NaNs or infinities that can propagate into ldf_ and full_triangle_ instead of zero runoff.
Reviewed by Cursor Bugbot for commit 40f977f. Configure here.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## disposal_rate_method #1021 +/- ##
========================================================
+ Coverage 88.94% 89.09% +0.14%
========================================================
Files 89 91 +2
Lines 5139 5228 +89
Branches 660 666 +6
========================================================
+ Hits 4571 4658 +87
- Misses 398 400 +2
Partials 170 170
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|


Summary of Changes
Related GitHub Issue(s)
Additional Context for Reviewers
uv run pytest) and documentation changes (uv run jb build docs --builder=custom --custom-builder=doctest)Note
Medium Risk
Introduces a new reserving path that derives link ratios and full triangles from disposal rates and ultimates; incorrect use could materially change IBNR projections, though scope is limited to the new estimator plus a small shared base-class refactor.
Overview
Adds
DisposalRate, a new adjustment estimator onDevelopmentBasethat implements Friedland’s disposal-rate approach: observed cumulative counts (or similar) are divided by supplied ultimates (sample_weight), weighted/fitted like other development factors, andtransformrebuildsldf_from fitted disposal patterns and future run-off sofull_triangle_can extend the lower triangle.The class is exported from
chainladder.adjustmentsand the top-level package, with a regression test on the Friedland GL insurer closed-claim sample (fitted disposal rates and incremental lower-triangle deltas).Refactor:
_param_propertymoves fromIncrementalAdditiveto a shared static helper onDevelopmentBase(used by disposal and incremental fitting);DevelopmentBasetype hints switch fromTriangleLiketoTriangle.Reviewed by Cursor Bugbot for commit 40f977f. Bugbot is set up for automated code reviews on this repo. Configure here.