Improved docstring and added examples for Development class#834
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #834 +/- ##
==========================================
+ Coverage 86.94% 87.18% +0.24%
==========================================
Files 86 86
Lines 4994 5143 +149
Branches 644 656 +12
==========================================
+ Hits 4342 4484 +142
- Misses 462 466 +4
- Partials 190 193 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| Examples | ||
| -------- | ||
|
|
||
| There are lots of parameters to control the development pattern selection. |
There was a problem hiding this comment.
it's difficult to appreciate these examples by examining the estimate ldf_. it would be more instructive to also show the age_to_age off the transformed triangle following this example.
ethan also has an outstanding PR that he's been working on. you'll likely have some merge conflicts.
There was a problem hiding this comment.
Let me add in the LDFs I think that's a good idea.
@EKtheSage can you respond to the PRs you submitted, I don't think you are working on the development class and my has the newer stuff that was just merged.
There was a problem hiding this comment.
i see the original ata factors, but not the transformed ata factors.
There was a problem hiding this comment.
The Development class currently doesn't return any transformed age-to-age triangle as an attribute, but it actually goes one step further and actually estimate the LDFs and CDFs.
If you think there's value is seeing the transformed age-to-age triangles we will need to implement it, but I'm not sure that should sit in the Development class because Development() is an LDF/CDF estimator. We could probably do the weights or something? This is because we want follow SKLearn's implementation where model and data are supposed to be separated.
If we want the .fit() to return another attribute called weights we can make another ticket and I can try to work on that.
There was a problem hiding this comment.
this example is for the Development class itself? so a transformed triangle should be within scope.
my original point was just that showing the ldf_ doesn't intuitively demonstrate what the drop parameter is doing. but showing the transformed link ratios does.
There was a problem hiding this comment.
That's my point. The current implantation doesn't show the transformed triangle.
Maybe I'm not following you. What code do you want to show in the docstring?
There was a problem hiding this comment.
something like cl.Development().fit_transform(tri).link_ratio. basically this.
There was a problem hiding this comment.
Ahh I see what you're saying now, that's good, I'll add that.
| tri = cl.load_sample("xyz") | ||
| print(cl.Development(drop_above=[2.0, 1.5, 1.3, 1.2, 1.1, 1.07, 1.05, 1.03, 1.01, 1.00]).fit_transform(tri["Incurred"]).link_ratio) | ||
|
|
||
| .. testoutput:: |
There was a problem hiding this comment.
how come this doesn't bring a test fail
There was a problem hiding this comment.
Ahh I got lucky, because the bottom one passes and I think it only checks the latest one (instead of appending the result).
Summary of Changes
Improved doctoring documentation, added a section on the order of drop operations, and added some examples
Related GitHub Issue(s)
#704
Additional Context for Reviewers
N/A
uv run pytest) and documentation changes (uv run jb build docs --builder=custom --custom-builder=doctest)Note
Low Risk
Documentation and doctest examples only; LDF calculation logic in
fitis unchanged.Overview
Expands
Developmentclass documentation only—no runtime or API behavior changes.Parameter descriptions now cross-reference a new Notes (Order of Drop Operations) section that documents how drop-related options compose (
n_periods→drop→drop_valuation→ rank/threshold drops withpreserve).averageis documented as accepting literals or a list of literals.drop_high,drop_low,drop_above, anddrop_belowexplicitly mentionpreserveprotection.A large Examples block adds doctest-style walkthroughs on the xyz sample triangle: inspecting link ratios, single-cell
drop, per-agedrop_above, combineddrop_above/drop_belowwithpreserve=3, andaverage="simple"for LDF output.Reviewed by Cursor Bugbot for commit 8219602. Bugbot is set up for automated code reviews on this repo. Configure here.