Skip to content

Add back some missing moments #5147

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

Merged
merged 7 commits into from
Nov 6, 2021

Conversation

michaeloriordan
Copy link
Contributor

Add moments and tests for the below distributions as part of #5078

  • pymc.distributions.continuous.Kumaraswamy
  • pymc.distributions.continuous.Exponential
  • pymc.distributions.continuous.Laplace
  • pymc.distributions.continuous.StudentT
  • pymc.distributions.continuous.Cauchy

@codecov
Copy link

codecov bot commented Nov 6, 2021

Codecov Report

Merging #5147 (bab2a1e) into main (e11969a) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5147      +/-   ##
==========================================
+ Coverage   77.79%   77.80%   +0.01%     
==========================================
  Files          88       88              
  Lines       14121    14145      +24     
==========================================
+ Hits        10985    11006      +21     
- Misses       3136     3139       +3     
Impacted Files Coverage Δ
pymc/distributions/continuous.py 95.70% <100.00%> (+0.12%) ⬆️
pymc/backends/report.py 89.51% <0.00%> (-2.10%) ⬇️

@@ -1399,6 +1405,12 @@ def dist(cls, lam, *args, **kwargs):
# Aesara exponential op is parametrized in terms of mu (1/lam)
return super().dist([at.inv(lam)], **kwargs)

def get_moment(rv, size, lam):
Copy link
Member

@ricardoV94 ricardoV94 Nov 6, 2021

Choose a reason for hiding this comment

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

We are converting lam to mu in the dist class method, so get_moment should expect mu already and you don't need to invert it (the same happens with the logcdf below).

That's why your tests are failing for the exponential.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah that makes sense, thanks! I'll make that change.

Copy link
Member

@ricardoV94 ricardoV94 left a comment

Choose a reason for hiding this comment

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

Looks good to me. Waiting to see if the tests pass

@ricardoV94 ricardoV94 merged commit a099292 into pymc-devs:main Nov 6, 2021
@ricardoV94
Copy link
Member

Thanks once again @michaeloriordan!

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