Skip to content

Conversation

lucaseckes
Copy link

@lucaseckes lucaseckes commented Sep 26, 2025

Adds ICDF functions to Inverse Gamma distribution

Description

The quantile function depends on the quantile function of Gamma distribution: #6845

Related Issue

Checklist

  • Checked that the pre-commit linting/style checks pass
  • Included tests that prove the fix is effective or that the new feature works
  • Added necessary documentation (docstrings and/or example notebooks)
  • If you are a pro: each commit corresponds to a [relevant logical change]

Type of change

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

📚 Documentation preview 📚: https://pymc--7917.org.readthedocs.build/en/7917/

Copy link

welcome bot commented Sep 26, 2025

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.

Copy link

codecov bot commented Sep 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.63%. Comparing base (340e403) to head (45b0b36).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #7917   +/-   ##
=======================================
  Coverage   91.62%   91.63%           
=======================================
  Files         116      116           
  Lines       18852    18856    +4     
=======================================
+ Hits        17274    17278    +4     
  Misses       1578     1578           
Files with missing lines Coverage Δ
pymc/distributions/continuous.py 98.26% <100.00%> (+<0.01%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@jessegrabowski jessegrabowski 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! @ricardoV94 do you want to check it before I snap merge?

)

def icdf(value, alpha, beta):
res = 1 / Gamma.icdf(value=1 - value, alpha=alpha, scale=1 / beta)
Copy link
Member

Choose a reason for hiding this comment

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

Better to use the stable API, and then you don't need to hack with the scale thing either

Suggested change
res = 1 / Gamma.icdf(value=1 - value, alpha=alpha, scale=1 / beta)
res = 1 / icdf(Gamma.dist(alpha=alhpa, beta=beta), value=1 - value)

)

def icdf(value, alpha, beta):
res = 1 / Gamma.icdf(value=1 - value, alpha=alpha, scale=1 / beta)
Copy link
Member

@ricardoV94 ricardoV94 Sep 30, 2025

Choose a reason for hiding this comment

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

For curiosity only, any intuition why the icdf looks like it does, specially the flipped value. It's interesting

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.

3 participants