Repository navigation
Conversation
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): 50.0% fully typed (5 / 10)
Patch symbol details
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1484 +/- ##
==========================================
+ Coverage 94.15% 94.19% +0.03%
==========================================
Files 96 96
Lines 5852 5890 +38
Branches 739 751 +12
==========================================
+ Hits 5510 5548 +38
Misses 221 221
Partials 121 121
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:
|
| patterns = patterns.cdf_ | ||
| elif hasattr(patterns, "ldf_") and style == "ldf": | ||
| patterns = patterns.ldf_ | ||
| elif hasattr(patterns, "cdf_") and not hasattr(patterns, "ldf_"): |
There was a problem hiding this comment.
this is a neat convenience feature. could you please either document it in the docstring or throw a warning?
| elif hasattr(patterns, "ldf_") and not hasattr(patterns, "cdf_"): | ||
| patterns = patterns.ldf_ | ||
|
|
||
| if hasattr(patterns, "values") and hasattr(patterns, "ddims"): |
There was a problem hiding this comment.
a transformed triangle may have ldf_ and wouldn't get here
Summary of Changes
Extends
cl.DevelopmentConstantto natively accept development patterns in tabular and object formats without requiring manual dictionary conversions:pd.Seriesindexed by development ages or interval strings (e.g.,'12-24')pd.DataFramecl.Triangleobjects (e.g.,estimator.ldf_orestimator.cdf_)ldf_orcdf_attributestest_constant.pycovering all supported input formats and validation guards.Related GitHub Issue(s)
Closes #1483
AI/LLM Usage
Used basic model for drafting unit test cases.
Additional Context for Reviewers
Submitter's Checklist
Reviewer's Checklist
Note
Medium Risk
Changes how external development patterns are parsed and mapped to ages; mistakes could skew LDF/CDF outputs, though dict/callable paths are preserved and coverage is broad.
Overview
DevelopmentConstantcan take external development patterns aspd.Series, 1-row/1-columnDataFrame, single-originTriangle(e.g. another model’sldf_/cdf_), or fitted estimators with those attributes—not only a plaindictor callable.Non-callable inputs are converted via new
_normalize_patterns, which resolvesldf_/cdf_from estimators perstyle, parses development ages from labels like12-24, and rejects invalid shapes (multi-origin triangles, 2D DataFrames, unsupported types). Constructor typing and docs are updated;fitbehavior for callables is unchanged.Tests cover each accepted format, index parsing, estimator fallbacks, and the new validation errors.
Reviewed by Cursor Bugbot for commit f9fd483. Bugbot is set up for automated code reviews on this repo. Configure here.