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

Add truncated distribution #370

Merged
merged 6 commits into from
Mar 21, 2024
Merged

Conversation

aloctavodia
Copy link
Contributor

@aloctavodia aloctavodia commented Mar 21, 2024

This is not a distribution per se, instead modifies distributions. For instance

pz.Truncated(pz.Poisson(4.5), 1, 10)

is a Poisson distribution truncated at a lower value of 1 and an upper value of 10.

Methods like plot_pdf and hdi work, but others like mean and variance are not available. It works with pz.maxent or pz.quartile. For maxent the approximation I am using is to comoute the entropy of the underlying untruncated distribution, I need to better understand when this will fail.

This is not intended to replace the distribution TruncatedNormal, while this is a general method to obtain truncated distribution, TruncatedNormal implements methods like mean, entropy, etc not directly available with this general approach

@codecov-commenter
Copy link

codecov-commenter commented Mar 21, 2024

Codecov Report

Attention: Patch coverage is 78.69822% with 36 lines in your changes are missing coverage. Please review.

Project coverage is 82.29%. Comparing base (d5b168e) to head (d30b4aa).

Files Patch % Lines
preliz/distributions/distributions.py 58.62% 24 Missing ⚠️
preliz/distributions/truncated.py 86.56% 9 Missing ⚠️
preliz/internal/optimization.py 57.14% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #370      +/-   ##
==========================================
- Coverage   82.41%   82.29%   -0.12%     
==========================================
  Files          56       58       +2     
  Lines        5231     5388     +157     
==========================================
+ Hits         4311     4434     +123     
- Misses        920      954      +34     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@aloctavodia aloctavodia merged commit 4e9ae8e into arviz-devs:main Mar 21, 2024
4 checks passed
@aloctavodia aloctavodia deleted the truncated branch March 21, 2024 22:13
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.

None yet

2 participants