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

Improve logsumexp to work with infinite values #4360

Merged
merged 3 commits into from
Dec 20, 2020

Conversation

ricardoV94
Copy link
Member

Changed math.logsumexp to work with infinite values, in line with how scipy.special.logsumexp works.

pm.math.logsumexp([-np.inf, -np.inf]).eval()   # used to return array([nan]), now returns array([-inf])

Added new unit tests, comparing the behavior with that of the scipy function. Except for the first two tests, all tests are failing in the current version of master, and pass after the PR.

@ricardoV94 ricardoV94 changed the title Improve logsumexp Improve logsumexp to work with infinite values Dec 20, 2020
@codecov
Copy link

codecov bot commented Dec 20, 2020

Codecov Report

Merging #4360 (1caf89b) into master (34447a7) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #4360   +/-   ##
=======================================
  Coverage   87.95%   87.95%           
=======================================
  Files          88       88           
  Lines       14499    14500    +1     
=======================================
+ Hits        12752    12753    +1     
  Misses       1747     1747           
Impacted Files Coverage Δ
pymc3/math.py 68.64% <100.00%> (+0.17%) ⬆️

Copy link
Contributor

@AlexAndorra AlexAndorra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, thanks @ricardoV94 !

@AlexAndorra AlexAndorra merged commit 0e9b9a4 into pymc-devs:master Dec 20, 2020
@ricardoV94 ricardoV94 deleted the improve_logsumexp branch December 20, 2020 12:55
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 this pull request may close these issues.

2 participants