Skip to content
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

Mathematical error in gamma-nloglik eval_metric calculation? #7273

Closed
rwjmiller opened this issue Sep 28, 2021 · 1 comment · Fixed by #7275
Closed

Mathematical error in gamma-nloglik eval_metric calculation? #7273

rwjmiller opened this issue Sep 28, 2021 · 1 comment · Fixed by #7275

Comments

@rwjmiller
Copy link

rwjmiller commented Sep 28, 2021

I notice that this seems to have changed a few months ago following this discussion:

https://github.com/dmlc/xgboost/pull/6778/files/625c374b493612f90c1c242cfe7c215571a48a52#diff-67879cd710406fb4e525362b7317b91633f3881b2813cd0e36e2e1ed8b5293b5

Before this change, the expression for the row-wise log-likelihood, in terms of p = prediction and y = response value, simplified down to:

gamma-nloglik = log(p) + y/p

After this change, the expression simplifies down to:

gamma-nloglik = 1 + y/p

I believe the original expression is the correct one, and this change should be reverted - i.e. this line should be un-commented:

// b = -std::log(-theta);

and this line should be removed:

The two definitions are definitely not equivalent as suggested in the discussion - I get very different values when calculating this metric for the same data with different XGBoost versions from before and after this change.

@trivialfis
Copy link
Member

Thanks for opening the issue! Let me double check, can't remember how did I put it in there but seems you are right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants