-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression Gamma Loss Gradient calculation is incorrect with weight #4174
Comments
Thanks for opening an issue! Are you interested in contributing a fix? |
@katrat123 Yes, that's a mistake. Thanks for reporting that! |
Sure can do. Just create a branch and submit a pull request?
Kate Ely
Analyst II, Data Science – Pricing Sophistication
Liberty Mutual Insurance
Safeco Plaza 1001 4th Ave, Seattle, WA 98154
Direct Dial: 425-519-5632
***@***.***D73151.276743F0]
From: James Lamb ***@***.***>
Sent: Tuesday, April 13, 2021 5:11 PM
To: microsoft/LightGBM ***@***.***>
Cc: Ely, Kathryn <Kathryn.Ely@LibertyMutual.com>; Author ***@***.***>
Subject: {EXTERNAL} Re: [microsoft/LightGBM] Regression Gamma Loss Gradient calculation is incorrect with weight (#4174)
Thanks for opening an issue! Are you interested in contributing a fix?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#4174 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ATVHXBUZBAZPAU5KY4ZUFLDTITMPNANCNFSM424CRN2Q>.
|
Yes please! The process is:
Let me know if you run into any issues! Thanks again for helping to improve LightGBM 🙌 |
Gently ping @katrat123 |
OOO next week; will do upon my return.
Thanks!
Kate
Kate Ely
Analyst II, Data Science – Pricing Sophistication
Liberty Mutual Insurance
Safeco Plaza 1001 4th Ave, Seattle, WA 98154
Direct Dial: 425-519-5632
***@***.***D73DB8.9D4635E0]
From: Nikita Titov ***@***.***>
Sent: Wednesday, April 28, 2021 5:36 AM
To: microsoft/LightGBM ***@***.***>
Cc: Ely, Kathryn <Kathryn.Ely@LibertyMutual.com>; Mention ***@***.***>
Subject: {EXTERNAL} Re: [microsoft/LightGBM] Regression Gamma Loss Gradient calculation is incorrect with weight (#4174)
Gently ping @katrat123<https://github.com/katrat123>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#4174 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ATVHXBWNZGAPG2EMPLT2AJTTK76MLANCNFSM424CRN2Q>.
|
@StrikerRUS : Weighted Gamma regression is a quite typical model in insurance claim modelling. The response is the claim cost divided by the number of claims, while the weight is the number of claims. I think it would be good to fix this for the next release. |
Have been OOO, would be great if you can complete the pull request.
Thanks!
Kate
Kate Ely
Analyst II, Data Science – Pricing Sophistication
Liberty Mutual Insurance
Safeco Plaza 1001 4th Ave, Seattle, WA 98154
Direct Dial: 425-519-5632
***@***.***D747D8.CE9A3680]
From: Michael Mayer ***@***.***>
Sent: Thursday, May 13, 2021 12:37 AM
To: microsoft/LightGBM ***@***.***>
Cc: Ely, Kathryn <Kathryn.Ely@LibertyMutual.com>; Mention ***@***.***>
Subject: {EXTERNAL} Re: [microsoft/LightGBM] Regression Gamma Loss Gradient calculation is incorrect with weight (#4174)
@StrikerRUS<https://github.com/StrikerRUS> : Weighted Gamma regression is a quite typical model in insurance claim modelling. The response is the claim cost divided by the number of claims, while the weight is the number of claims. I would love to see this fixed.
@katrat123<https://github.com/katrat123> : If you do not have started and are short of time, I can do that pull request!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#4174 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ATVHXBQ7NHPBUZJOWKGY3OTTNN6RJANCNFSM424CRN2Q>.
|
This issue has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this. |
Description
In src/objective/regression_objective.hpp, line 698 the weight term is only being applied to a single term, rather than the entire expression. As a result, the weighted calculation of gamma objective is incorrect :
gradients[i] = static_cast<score_t>(1.0 - label_[i] / std::exp(score[i]) * weights_[i]);
Reproducible example
Lightgbm simplified code (incorrect) : (1.0 - y / exp(p) * w)
Xgboost simplified code (correct) : (1 - y / exp(p)) * w
Lightgbm simplifed code (correct) : (1-y/exp(p))*w
Tweedie, rho = 2 (gamma) simplified code : ((-y * exp(-1 * p) + exp(0 * p)) * w === (1 – y / exp(p)) * w
The text was updated successfully, but these errors were encountered: