Skip to content

Add an ultimate label alias, global and per-Triangle - #1351

Open
Abhayindia wants to merge 2 commits into
casact:mainfrom
Abhayindia:feature/ultimate-alias-1345
Open

Add an ultimate label alias, global and per-Triangle#1351
Abhayindia wants to merge 2 commits into
casact:mainfrom
Abhayindia:feature/ultimate-alias-1345

Conversation

@Abhayindia

Copy link
Copy Markdown
Contributor

Adds ULT_LABEL as a global option plus a per-Triangle ult_label that overrides it, as discussed on the issue.

The alias is applied at display time only - _repr_format, which __repr__, _repr_html_ and to_frame all go through - so ddims and .development keep the ULT_VAL/9999 sentinel and nothing downstream changes. That matters for things like utility_functions.py's run-off filter, which string-compares development labels against a valuation date.

>>> ult = cl.Chainladder().fit(cl.load_sample('raa')).ultimate_
>>> list(ult.to_frame(origin_as_datetime=False).columns)
['2261']
>>> cl.options.set_option('ULT_LABEL', 'Ultimate')
>>> list(ult.to_frame(origin_as_datetime=False).columns)
['Ultimate']
>>> override = ult.copy(); override.ult_label = 'ULT'
>>> list(override.to_frame(origin_as_datetime=False).columns)
['ULT']
>>> list(ult.to_frame(origin_as_datetime=False).columns)   # global untouched
['Ultimate']
>>> ult.development.tolist()                               # sentinel intact
['2261']

It covers the 9999 development-lag case too, e.g. full_expectation_ ends [..., 132, 'Ultimate'].

I left the default as None so nothing changes unless you opt in - happy to default it to "Ultimate" if that's the [BRK] you had in mind, it's a one-line change.

pytest chainladder gives 1142 passed. The 2 remaining failures are test_heatmap_render, which fails the same way on a clean checkout here (no IPython in my venv).

Closes #1345.

@github-actions

github-actions Bot commented Sep 13, 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 / 1382)

Known Ambiguous Unknown Total
Project (head) 209 111 1062 1382

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): 50.0% fully typed (1 / 2)

Known Ambiguous Unknown Total
Patch 1 0 1 2
Patch symbol details
Symbol Status Change
chainladder.core.triangle.Triangle.ult_label ❌ unknown new
chainladder.utils.tests.test_utilities.test_ult_label ✅ known new

@codecov

codecov Bot commented Sep 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.78%. Comparing base (6b51f64) to head (1b64076).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1351      +/-   ##
==========================================
+ Coverage   91.76%   91.78%   +0.02%     
==========================================
  Files          96       96              
  Lines        5475     5490      +15     
  Branches      706      708       +2     
==========================================
+ Hits         5024     5039      +15     
  Misses        327      327              
  Partials      124      124              
Flag Coverage Δ
unittests 91.78% <100.00%> (+0.02%) ⬆️

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.

@Abhayindia

Copy link
Copy Markdown
Contributor Author

saw @henrydingliu's note on #1345 - i built this to the spec genedan gave there, so no attachment to it either way. happy to close if the team lands on not wanting it.

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.

[ENH]/[BRK] Add ultimate alias

1 participant