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

Fix: Incorrect use of partial in TweedieDistribution._rowwise_gradient_hessian #889

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@
Changelog
=========

3.1.0 - unreleased
3.1.1 - unreleased
------------------

**Bug fix:

- Fixed a bug where `TweedieDistribution._rowwise_gradient_hessian` would pass `p` paramter to `inv_gaussian_log_rowwise_gradient_hessian`, even though `p` is not defined in its function signature.


3.1.0
------------------

**New features:**
Expand Down
4 changes: 2 additions & 2 deletions src/glum/_distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ def _rowwise_gradient_hessian(
elif 1 < self.power < 2 and isinstance(link, LogLink):
f = partial(tweedie_log_rowwise_gradient_hessian, p=self.power)
elif self.power == 3:
f = partial(inv_gaussian_log_rowwise_gradient_hessian, p=self.power)
f = inv_gaussian_log_rowwise_gradient_hessian

if f is not None:
return f(y, sample_weight, eta, mu, gradient_rows, hessian_rows)
Expand Down Expand Up @@ -703,7 +703,7 @@ def _eta_mu_deviance(
elif 1 < self.power < 2 and isinstance(link, LogLink):
f = partial(tweedie_log_eta_mu_deviance, p=self.power)
elif self.power == 3 and isinstance(link, LogLink):
f = partial(inv_gaussian_log_eta_mu_deviance, p=self.power)
f = inv_gaussian_log_eta_mu_deviance

if f is not None:
return f(cur_eta, X_dot_d, y, sample_weight, eta_out, mu_out, factor)
Expand Down