You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] TweedieGLM never passes alpha to TweedieRegressor #1584
Yes, this bug occurs on the latest version (main at 0e5a7a9: chainladder 0.10.1, Python 3.12.15, numpy 2.3.3, pandas 2.3.3, scikit-learn 1.7.2).
Describe the bug in words
TweedieGLM stores alpha (glm.py L208) but builds its TweedieRegressor without it (L227–L235), so every fit uses scikit-learn's default penalty of 1.0. alpha=0 therefore doesn't give the unpenalized GLM the docstring describes (L64–L68): on ukmotor its IBNR comes out 4.2% above chain ladder. No commit in the history has passed alpha.
With alpha=self.alpha passed, both asserts pass and the repro prints 0, 28655.8 and 28655.8. I have that one-line change locally with a regression test in test_glm.py. The default stays 1.0, so fits that don't set alpha are unchanged.
Would you be willing to contribute this ticket?
Yes, absolutely!
Yes, but I would like some help.
No.
(This issue was written with Árbol, an AI assistant, under my direction.)
It is close but not exact, and alpha=0 cannot fix it on main because TweedieGLM never passes alpha to the regressor. The gallery fit runs with a penalty of 1.0 whatever alpha says.
On genins the penalty barely shows. The GLM 12-24 factor is 3.4910 against 3.4906 from Development, the largest gap across ages is 0.00042, and total ultimate is 53,041,750 against 53,038,946. On smaller amounts it matters more. On ukmotor the 12-24 factor is 1.9040 against 1.8892, and total ultimate is 105,538 against 104,328.
With the fix in #1663, TweedieGLM(alpha=0) on genins gives a largest factor gap of 0.0000008 and total ultimate 53,038,955. On ukmotor it gives 1.8892 and 104,328. The default stays alpha=1.0, so #1663 also sets alpha=0 in the gallery example, and "shown to match" now holds to within 0.0000008.
(This comment was written with Árbol, an AI assistant, under my direction.)
Activity
henrydingliu commentedon Nov 18, 2026
is this a lie? or does alpha=0 fix it?
scks1 commentedon Nov 18, 2026
It is close but not exact, and alpha=0 cannot fix it on main because TweedieGLM never passes alpha to the regressor. The gallery fit runs with a penalty of 1.0 whatever alpha says.
On genins the penalty barely shows. The GLM 12-24 factor is 3.4910 against 3.4906 from
Development, the largest gap across ages is 0.00042, and total ultimate is 53,041,750 against 53,038,946. On smaller amounts it matters more. On ukmotor the 12-24 factor is 1.9040 against 1.8892, and total ultimate is 105,538 against 104,328.With the fix in #1663,
TweedieGLM(alpha=0)on genins gives a largest factor gap of 0.0000008 and total ultimate 53,038,955. On ukmotor it gives 1.8892 and 104,328. The default stays alpha=1.0, so #1663 also setsalpha=0in the gallery example, and "shown to match" now holds to within 0.0000008.(This comment was written with Árbol, an AI assistant, under my direction.)
[FIX] Pass alpha from TweedieGLM to TweedieRegressor
[DOCS] Use TweedieGLM with alpha=0 in the origin-varying example
[DOCS] Use TweedieGLM with alpha=0 in the origin-varying example