Repository navigation
ENH: Tweedie log-likelihood (+ridge regression by gradient for all GLM) - #5521
Conversation
| llf *= -1 / 2 | ||
|
|
||
| u = endog ** (2 - p) - (2 - p) * endog * mu ** (1 - p) + (1 - p) * mu ** (2 - p) | ||
| u *= var_weights / (scale * (1 - p)**2) |
There was a problem hiding this comment.
When testing with sas's formula I realize they actually have a typo it is (1-p)*(2-p) not (1-p)**2
There was a problem hiding this comment.
Thanks, I will fix it. It you have a separate PR with better tests we can go with yours.
There was a problem hiding this comment.
So I actually liked a paper by Kaas when I was studying this...
Page 8 has his formula for EQL (formula 4). The deviance on page 7 (formula 3) should pretty much be our _resid_dev method. You could call the existing method instead of re-writing it. You just have to add on the var_weights piece and the 2 * pi * scale adjustment.
You might also want to note in the doctoring that I think this EQL function is only valid when 1 < p < 2.
There was a problem hiding this comment.
Yes exactly, only valid between 1 < p < 2 because at 1 you would use poisson and at 2 gamma.
| http://support.sas.com/documentation/cdl/en/stathpug/67524/HTML/default/viewer.htm#stathpug_hpgenselect_details16.htm | ||
| """ | ||
| return np.nan | ||
| if self.eql == False: |
There was a problem hiding this comment.
Also has this been PEP8'ed? I recall that its preferred just to do a if not self.eql: but I have no clue what the rule is... But I feel like I've seen it somewhere...
Codecov Report
@@ Coverage Diff @@
## master #5521 +/- ##
==========================================
- Coverage 82.05% 82.02% -0.03%
==========================================
Files 586 586
Lines 92741 92790 +49
Branches 10281 10287 +6
==========================================
+ Hits 76095 76112 +17
- Misses 14290 14318 +28
- Partials 2356 2360 +4
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #5521 +/- ##
==========================================
- Coverage 82.04% 82.02% -0.02%
==========================================
Files 586 586
Lines 92741 92793 +52
Branches 10281 10288 +7
==========================================
+ Hits 76086 76112 +26
- Misses 14296 14320 +24
- Partials 2359 2361 +2
Continue to review full report at Codecov.
|
|
@kshedden I've been using your modified version and really like the new tweedie regularized fit! I was wondering, in general, how often are pull requests released to master on this repo and also, secifically, do we have an idea of when this PR will be released? Thank you for the improvements! |
|
@LudvicLaberge Thanks for the feedback. We are in a bit of limbo now with broken master. But I will merge anyway in a week or so if things don't clear up. |
|
@kshedden Looking at the test suite results, it looks like your new test is failing on the python 2.7 travis-ci instances. Want to take a look at that? |
The quasi-likelihood allows fit_regularized to be used with Tweedie family GLM's.
Also bypasses coordinate-descent when calling fit_regularized on a GLM with L1_wt=0. This is ridge regression and can be fit more efficiently and accurately using gradients optimization.
#3670