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 ExGaussian logp #4050

Merged
merged 2 commits into from
Aug 14, 2020
Merged

Conversation

AlexAndorra
Copy link
Contributor

This is a proper version of #4049, with all the changes related to the ExGaussian's logp.
As suggested by @junpenglao in #4045, this PR adds a tt.switch statement in the ExGaussian logp to replace 0 with epsilon. That way, std_cdf never returns 0, and logpow never returns -inf.

The changes seem to work: pm.ExGaussian.dist(0., .25, 1./6).logp(y).eval() doesn't contain -inf anymore, and the model in Discourse doesn't raise a BadInitialEnergy error.

Thanks for the reviews 🖖

@AlexAndorra AlexAndorra linked an issue Aug 14, 2020 that may be closed by this pull request
@codecov
Copy link

codecov bot commented Aug 14, 2020

Codecov Report

Merging #4050 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #4050   +/-   ##
=======================================
  Coverage   86.81%   86.82%           
=======================================
  Files          88       88           
  Lines       14150    14154    +4     
=======================================
+ Hits        12285    12289    +4     
  Misses       1865     1865           
Impacted Files Coverage Δ
pymc3/distributions/continuous.py 80.09% <100.00%> (+0.07%) ⬆️

@junpenglao junpenglao merged commit 8dbfc75 into pymc-devs:master Aug 14, 2020
@junpenglao
Copy link
Member

Thanks!

@AlexAndorra AlexAndorra deleted the fix-exgaussian-logp-bis branch August 14, 2020 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ExGaussian logp is numerical unstable
2 participants