Skip to content

Implement icdf for Truncated distributions - #8371

Open
prisharai wants to merge 1 commit into
pymc-devs:mainfrom
prisharai:truncated-icdf
Open

Implement icdf for Truncated distributions#8371
prisharai wants to merge 1 commit into
pymc-devs:mainfrom
prisharai:truncated-icdf

Conversation

@prisharai

Copy link
Copy Markdown
Contributor

Description

Registers _icdf for TruncatedRV so pm.icdf works with pm.Truncated whenever the base distribution has an icdf.

Follows the suggestions in #8354 (comment): uses _create_logcdf_exprs (which handles the -1 for discrete), rescales the quantile onto [cdf(lower), cdf(upper)] in logspace, and passes it to the base icdf. This is the same expression rv_op uses for inverse-CDF sampling. q = 1 maps exactly to cdf(upper) so roundoff can't push it past the boundary. Bases without an icdf still raise NotImplementedError.

Related Issue

Checklist

Type of change

  • New feature / enhancement
  • Bug fix
  • Documentation
  • Maintenance
  • Other (please specify):

@welcome

welcome Bot commented Jul 20, 2026

Copy link
Copy Markdown

Thank You Banner]
💖 Thanks for opening this pull request! 💖 The PyMC community really appreciates your time and effort to contribute to the project. Please make sure you have read our Contributing Guidelines and filled in our pull request template to the best of your ability.

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 pymc | 🛠️ Build #33659334 | 📁 Comparing b7797b8 against latest (91157fd)

  🔍 Preview build  

2 files changed
± glossary.html
± _modules/pymc/distributions/truncated.html

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.

1 participant