Repository navigation
Conversation
_get_triangle_ml stepped projected valuations by adding dgrain / 12 in floating point and then looked them up in valuation_encoder_ by exact match. For monthly grain the sums drift from the encoder's values, so most projected cells became NaN and were dropped, and DevelopmentML and BarnettZehnwirth ultimates no longer matched chain ladder on exact data. Projected valuations now come from the integer valuation index, divided once in the same way as the encoder. The new test fits a Poisson GLM to a monthly triangle with an exact multiplicative pattern and checks the square is complete and the ultimates match Chainladder. Developed with an AI assistant (Árbol, running Muse).
scks1
requested review from
genedan,
henrydingliu and
kennethshsu
as code owners
November 16, 2026 19:39
Pyright Type CompletenessView the full Project (full
Other symbols referenced but not exported by
Symbols without documentation:
Patch (exported symbols added or changed by this PR): 0.0% fully typed (0 / 1)
Patch symbol details
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1634 +/- ##
=======================================
Coverage 95.00% 95.00%
=======================================
Files 100 100
Lines 6461 6465 +4
Branches 820 820
=======================================
+ Hits 6138 6142 +4
Misses 204 204
Partials 119 119
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:
|
Member
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
DevelopmentML._get_triangle_mlnow builds projected valuations from the integer valuation index instead of addingdgrain / 12at each step. The repeated float addition drifted away fromvaluation_encoder_'s values on monthly triangles, so the exact lookup returned NaN and.dropna()removed most of the projected cells.BarnettZehnwirthuses the same function and is fixed too.test_monthly_poisson_glm_matches_chainladderfits a Poisson GLM with origin and development factors to an 8×8 monthly triangle with an exact multiplicative pattern, and checks thattriangle_ml_has no NaN and that the ultimates matchChainladder(Renshaw and Verrall, 1998). It fails on main at the NaN check and passes with the change.Related GitHub Issue(s)
Closes #1633
AI/LLM Usage
This change was made with Árbol, an AI assistant running on Muse, working under my direction. It found the bug, wrote the change and the test, ran the checks below and drafted this description.
Additional Context for Reviewers
DevelopmentMLBarnettZehnwirthThe
DevelopmentMLvalues left after the fix are the Tweedie solver's tolerance.genins'sldf_is unchanged.learning.pyorbarnzehn.py.The
chainladder/developmenttests pass (167 passed), and ruff check and format are clean on the changed files.Submitter's Checklist
[FIX],[FEAT],[DOCS],[TST],[CHORE], or[BRK]).Reviewer's Checklist