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

Gradient and hessian incorrect for inverse gaussian #891

Closed
stanmart opened this issue Jan 2, 2025 · 1 comment · Fixed by #889
Closed

Gradient and hessian incorrect for inverse gaussian #891

stanmart opened this issue Jan 2, 2025 · 1 comment · Fixed by #889

Comments

@stanmart
Copy link
Collaborator

stanmart commented Jan 2, 2025

I believe that inv_gaussian_log_rowwise_gradient_hessian is incorrect, and it should instead be

@@ -276,12 +276,12 @@ def inv_gaussian_log_rowwise_gradient_hessian(
         inv_mu = 1 / mu[i]
         inv_mu2 = inv_mu ** 2
 
-        gradient_rows_out[i] = 2 * weights[i] * (inv_mu - y[i] * inv_mu2)
-        hessian_rows_out[i] = 2 * weights[i] * (inv_mu - 2 * y[i] * inv_mu2)
+        gradient_rows_out[i] = weights[i] * (y[i] * inv_mu2 - inv_mu)
+        hessian_rows_out[i] = weights[i] * (2 * y[i] * inv_mu2 - inv_mu)

@lbittarello, let me know if you agree.

Originally posted by @stanmart in #889 (comment)

@lbittarello
Copy link
Member

Yes, the signs should be flipped.

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

Successfully merging a pull request may close this issue.

2 participants