Repository navigation
[DOCS] Show origin-varying ldf_ from DevelopmentML in the user guide - #1621
Conversation
Add an "Origin-varying patterns" subsection after PatsyFormula. The ODP cross-classified GLM gives one identical row of ldf_ per origin, equal to Development's pattern; an origin:I(development / 12) term gives each origin its own factors, and Chainladder applies each origin's own row. Developed with an AI assistant (Árbol, running Muse).
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): no exported symbol type-completeness changes detected. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1621 +/- ##
=======================================
Coverage 95.03% 95.03%
=======================================
Files 100 100
Lines 6471 6471
Branches 819 819
=======================================
Hits 6150 6150
Misses 203 203
Partials 118 118
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:
|
|
any reason you are calling |
|
assuming this is another alpha issue, can we please prioritize #1584? |
|
Yes, it is the alpha bug. TweedieGLM ignores alpha on main, so the example calls DevelopmentML directly to set alpha=0. With the #1584 fix, (This comment was written with Árbol, an AI assistant, under my direction.) |
|
thanks for the quick turnaround on #1663! |
With the casact#1584 fix merged in casact#1663, TweedieGLM passes alpha to its regressor, so the example no longer needs a hand-built DevelopmentML pipeline. Both genins fits and the ultimate ratios are unchanged. Developed with an AI assistant (Árbol, running Muse).
|
Now that #1663 is in, the origin-varying example uses
Codeimport chainladder as cl
genins = cl.load_sample("genins")
cross = cl.TweedieGLM(
design_matrix="C(development) + C(origin)", alpha=0, max_iter=1000
).fit(genins)
drift = cl.TweedieGLM(
design_matrix="C(development) + C(origin) + origin:I(development / 12)",
alpha=0,
max_iter=1000,
).fit(genins)
print(cross.ldf_.iloc[..., :3].round(3))
print(drift.ldf_.iloc[..., :3].round(3))
plain = cl.Chainladder().fit(cl.Development().fit_transform(genins))
drifted = cl.Chainladder().fit(drift.transform(genins))
print((drifted.ultimate_ / plain.ultimate_).round(3))(This comment was written with Árbol, an AI assistant, under my direction.) |
Summary of Changes
Adds a short "Origin-varying patterns" subsection to the DevelopmentML part of
docs/user_guide/development.ipynb, after the PatsyFormula section. It shows that:DevelopmentML.ldf_has one row per origin (shape(1, 1, 10, 9)on genins), whereDevelopment.ldf_has one row.C(development) + C(origin), log link, incrementals,alpha=0) gives the same row for every origin, matchingDevelopment().ldf_(3.491, 1.747, 1.457 for the first three ages) (Taylor and McGuire 2016, CAS Monograph 3, already cited in the user guide).origin:I(development / 12)gives each origin its own factors (12-24 runs from 3.432 for 2001 to 3.560 for 2010), andChainladderapplies each origin's own row: ultimates rise by 0.1% for 2002 up to 13.5% for 2010 against the plain chainladder.No code changes. The example avoids
drop/drop_valuation(see #1619) and usesDevelopmentMLdirectly so it can setalpha=0.Related GitHub Issue(s)
None.
AI/LLM Usage
This example was made with Árbol, an AI assistant running on Muse, working under my direction. It wrote the cells, ran them and the notebook test on main 1457b76, and checked each origin's ultimate against its latest diagonal times the product of its own factors (largest relative gap 3.5e-16). I reviewed the text and the numbers before submitting.
Additional Context for Reviewers
The
origin:I(development / 12)term is only an illustration of time-heterogeneity, and the note in the cell says so. It is not a model taken from Taylor and McGuire.Submitter's Checklist
[FIX],[FEAT],[DOCS],[TST],[CHORE], or[BRK]).Reviewer's Checklist