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

Implement Truncated distributions #6113

Merged
merged 3 commits into from
Sep 14, 2022
Merged

Conversation

ricardoV94
Copy link
Member

@ricardoV94 ricardoV94 commented Sep 9, 2022

What is this PR about?
Implement univariate Truncated distributions

import pymc as pm

x = pm.Truncated.dist(pm.StudentT.dist(nu=4, mu=0, sigma=10), lower=0, upper=[1, 5, 10])

pm.draw(x, 5, random_seed=42)
# array([[0.699283  , 1.16812888, 0.57187754],
#        [0.86696477, 2.77131277, 0.41684522],
#        [0.4936193 , 2.02239792, 4.89737532],
#        [0.21631044, 2.11718693, 9.98189683],
#        [0.79006093, 2.82316114, 6.90686285]])

pm.logp(x, [2, 2, 2]).eval()
# array([       -inf, -1.5841988 , -2.14689627])

Checklist

Major / Breaking Changes

  • ...

Bugfixes / New features

  • Implemented Truncated univariate distributions

Docs / Maintenance

  • Deprecation warning added for Bound distributions

@codecov
Copy link

codecov bot commented Sep 9, 2022

Codecov Report

Merging #6113 (26c70c1) into main (bbb3082) will increase coverage by 0.34%.
The diff coverage is 99.73%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #6113      +/-   ##
==========================================
+ Coverage   91.02%   91.37%   +0.34%     
==========================================
  Files          99      101       +2     
  Lines       20531    20887     +356     
==========================================
+ Hits        18689    19085     +396     
+ Misses       1842     1802      -40     
Impacted Files Coverage Δ
pymc/distributions/truncated.py 99.30% <99.30%> (ø)
pymc/distributions/__init__.py 100.00% <100.00%> (ø)
pymc/distributions/bound.py 100.00% <100.00%> (ø)
pymc/exceptions.py 100.00% <100.00%> (ø)
pymc/tests/distributions/test_bound.py 100.00% <100.00%> (ø)
pymc/tests/distributions/test_truncated.py 100.00% <100.00%> (ø)
pymc/variational/test_functions.py 38.09% <0.00%> (-61.91%) ⬇️
pymc/variational/stein.py 48.33% <0.00%> (-51.67%) ⬇️
pymc/variational/operators.py 57.14% <0.00%> (-35.72%) ⬇️
pymc/variational/inference.py 50.77% <0.00%> (-35.32%) ⬇️
... and 14 more

@drbenvincent
Copy link

Just leaving this here in the hope that I get notifications of this PR's progress.

@ricardoV94
Copy link
Member Author

ricardoV94 commented Sep 14, 2022

Weird variational test failing... opening an issue #6127

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

Successfully merging this pull request may close these issues.

3 participants