Skip to content

[FIX] Size and label TailBondy's fit from the pattern - #1600

Merged
henrydingliu merged 1 commit into
casact:mainfrom
scks1:fix-tailbondy-groupby-1599
Nov 14, 2026
Merged

henrydingliu merged 1 commit into
casact:mainfrom
scks1:fix-tailbondy-groupby-1599

Conversation

@scks1

@scks1 scks1 commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Summary of Changes

TailBondy now sizes its starting values and labels b_ from ldf_, as TailCurve does. With Development(groupby=...), ldf_ has one row per group while the triangle keeps one row per company, so TailBondy built its starting values with one row per company and its data with one row per group, and concatenate failed (#1599).

test_bondy_fits_grouped_development_pattern fits TailBondy on clrd's CumPaidLoss after Development(groupby="LOB") and checks that ldf_ and b_ match the fit on the triangle summed by line first.

Related GitHub Issue(s)

Fixes #1599

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

  1. TailClark fails on the same grouped pattern for a different reason: it refits ClarkLDF on every company. This PR leaves it alone. [BUG] TailBondy fails on a pattern fit with Development(groupby=...) #1599 describes it, and it looks like the reverse of [BUG] TailClark fails when X narrows from ldf_ #1432.
  2. [FEAT]deprecate date dims #1304 also edits bondy.py, and the two changes merge without conflict in that file.
  3. The new test fails on main with the concatenate ValueError and passes with the change.

The chainladder/tails tests (58 passed) and the other test files that use TailBondy (methods/tests/test_predict.py, tests/test_public_api.py and workflow/tests/test_workflow.py, 229 passed) pass with the uv.lock versions (numpy 2.3.3, pandas 2.3.3), and ruff 0.16.1 check and format are clean.

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).

With Development(groupby=...), ldf_ has one row per group while the
triangle keeps one row per company. TailBondy built its starting values
from the triangle's row count and labelled b_ with the triangle's index,
so the fit failed in concatenate. TailBondy fits only the pattern, so
take both from ldf_, as TailCurve does. The grouped fit then matches
summing by group before the fit. Closes casact#1599.

Developed with an AI assistant (Árbol, running Muse).
@github-actions

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): 18.1% of exported symbols fully typed (302 / 1664)

Known Ambiguous Unknown Total
Project (head) 302 96 1266 1664

Other symbols referenced but not exported by chainladder: 24

Known Ambiguous Unknown Total
Other (head) 11 1 12 24

Symbols without documentation:

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

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

Known Ambiguous Unknown Total
Patch 0 0 1 1
Patch symbol details
Symbol Status Change
chainladder.tails.tests.test_bondy.test_bondy_fits_grouped_development_pattern ❌ unknown new

@codecov

codecov Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.84%. Comparing base (9a4634b) to head (63f2f8d).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1600   +/-   ##
=======================================
  Coverage   94.84%   94.84%           
=======================================
  Files          99       99           
  Lines        6424     6425    +1     
  Branches      811      811           
=======================================
+ Hits         6093     6094    +1     
  Misses        212      212           
  Partials      119      119           
Flag Coverage Δ
unittests 94.84% <100.00%> (+<0.01%) ⬆️

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.

@henrydingliu

Copy link
Copy Markdown
Member

everything looks good. i'm away from my ide atm. i just need to run the test on main to ensure that it fails and i can approve.

have you tried to add a Development(groupby) into the big pipeline test in test_workflow? i wonder what else would fail

@henrydingliu
henrydingliu merged commit ec2dc67 into casact:main Nov 14, 2026
11 checks passed
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] TailBondy fails on a pattern fit with Development(groupby=...)

2 participants