Skip to content

[FIX] Fill every projected tail column in TailBondy - #1624

Open
scks1 wants to merge 1 commit into
casact:mainfrom
scks1:fix-tailbondy-grain
Open

scks1 wants to merge 1 commit into
casact:mainfrom
scks1:fix-tailbondy-grain

Conversation

@scks1

@scks1 scks1 commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Summary of Changes

TailBondy now fills every tail column that TailBase adds. It evaluated its fitted curve over two tail columns, so its ldf_ values and ddims disagreed on quarterly and monthly triangles, and on annual ones with projection_period outside 12–23 (#1623). It now evaluates the curve over each projected period too.

test_bondy_fills_every_projected_tail_column fits raa, quarterly and the summed monthly prism at projection_period 6, 12 and 24, and checks that ldf_ has TailConstant's columns and that tail_ matches the default fit.

Related GitHub Issue(s)

Fixes #1623

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. At the annual default the change keeps the same columns: raa's ldf_, cdf_, tail_ and b_ are identical to main's.
  2. [FEAT]deprecate date dims #1304 renames X.ddims to X.development on two of the lines this changes, so whichever merges second needs a two-line rebase. I can rebase this onto [FEAT]deprecate date dims #1304 if you'd rather.
  3. The new test fails on main with the reshape ValueError and passes with the change.

The chainladder/tails tests (66 passed), 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) and the plot_bondy_sensitivity and tails notebooks under nbmake 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).

TailBase.fit extends ldf_ by _ave_period[0] + 1 tail ages, but
TailBondy.fit rebuilt ldf_.values with two tail columns, so a quarterly
or monthly triangle, or an annual one with projection_period outside
12-23, failed with a reshape ValueError in nan_triangle. TailBondy now
evaluates its fitted curve over every projected period and fills each
tail column from it. The annual default output is unchanged.

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 (301 / 1667)

Known Ambiguous Unknown Total
Project (head) 301 96 1270 1667

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: 330
  • 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_fills_every_projected_tail_column ❌ unknown new

@codecov

codecov Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.94%. Comparing base (46727b1) to head (33949c9).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1624   +/-   ##
=======================================
  Coverage   94.94%   94.94%           
=======================================
  Files          99       99           
  Lines        6427     6428    +1     
  Branches      811      811           
=======================================
+ Hits         6102     6103    +1     
  Misses        207      207           
  Partials      118      118           
Flag Coverage Δ
unittests 94.94% <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

can we incorporate the #1304 edits on the changed lines?

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 non-annual triangles and with projection_period outside 12-23

2 participants