Repository navigation
Conversation
_normalize_patterns read only patterns.values[0, 0, 0, :], so a Triangle or fitted estimator holding one pattern per line of business or per measure gave every line and measure the first one's pattern, with no warning. It now raises a ValueError that points to the callable route. Fixes casact#1642 Developed with an AI assistant (Árbol, running Muse).
scks1
requested review from
genedan,
henrydingliu and
kennethshsu
as code owners
November 17, 2026 13:23
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 #1644 +/- ##
=======================================
Coverage 95.00% 95.00%
=======================================
Files 100 100
Lines 6460 6462 +2
Branches 819 820 +1
=======================================
+ Hits 6137 6139 +2
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:
|
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
DevelopmentConstantnow raises aValueErrorwhen a Triangle or fitted-estimator pattern has more than one index row or more than one column. Before,_normalize_patternsread onlypatterns.values[0, 0, 0, :]and applied that one pattern to every row and column of the triangle being fit, with no warning. The error message points to a callable withcallable_axisfor patterns that vary by row or column, and thepatternsdocstring now says the same.test_constant_pattern_with_several_index_rows_or_columnsfitsDevelopmenttoclrdsummed byLOB, with paid and incurred losses. It checks thatldf_, the fitted estimator, a one-column slice with six lines and a one-line slice with two columns all raise, and that a pattern with one line and one column still applies to all six lines. It fails on main, where nothing raises.Related GitHub Issue(s)
Closes #1642
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
Every other
DevelopmentConstantcall on main passes a dict or a callable: the library (CaseOutstanding), the tests, the Friedland chapters, the user guide and the gallery. So none of them reach the new check. The open Friedland PRs #1220 and #1327 also pass dicts.#1304 edits the lines just above and below the new check. Git merges this branch with #1304's head 4559f5c with no conflict in
constant.pyortest_constant.py. With this commit applied on top of 4559f5c, all 38 tests intest_constant.pypass.On this branch, 233 tests pass across
chainladder/development,test_exponential.py,test_capecod.pyandtest_triangle.py::test_single_entry, the last three because they also useDevelopmentConstant. ruff check and format are clean on the changed files.Submitter's Checklist
[FIX],[FEAT],[DOCS],[TST],[CHORE], or[BRK]).Reviewer's Checklist