Skip to content

Conversation

@jnetzel1
Copy link

@jnetzel1 jnetzel1 commented Sep 26, 2025

What is this PR about?
Adds ICDF functions to Logit Normal Distribution

Issue #6612

References:
Logit Normal:
https://en.wikipedia.org/wiki/Logit-normal_distribution

SciPy Implementations:
https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.expit.html
https://github.com/scipy/scipy/blob/d604a5462dadf799f8af2c177179a01875b40796/scipy/stats/_continuous_distns.py#L380

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--7916.org.readthedocs.build/en/7916/

@welcome
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.

@ricardoV94 ricardoV94 force-pushed the 6612/feature/add_logit_normal_icdf branch from b5dabcb to f9cb757 Compare November 8, 2025 10:41
@ricardoV94 ricardoV94 changed the title added logit normal icdf and test Add icdf for LogitNormal Nov 8, 2025
@ricardoV94 ricardoV94 changed the title Add icdf for LogitNormal Add icdf for LogitNormal Nov 8, 2025
@ricardoV94
Copy link
Member

@jnetzel1 I pushed some changes to automatically derive icdf (and logp/logcdf) for this simple distribution. There's no longer a native LogitNormal but a CustomDist

@ricardoV94 ricardoV94 force-pushed the 6612/feature/add_logit_normal_icdf branch from f9cb757 to f1dbc3e Compare November 8, 2025 10:47

@_mean.register(LogitNormalRV)
def logitnormal_mean(op, rv, rng, size, mu, sigma):
raise UndefinedMomentException("The mean of the LogitNormal distribution is undefined")
Copy link
Member

Choose a reason for hiding this comment

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

Small note: It isn't really undefined, just doesn't have a closed form solution

@codecov
Copy link

codecov bot commented Nov 8, 2025

Codecov Report

❌ Patch coverage is 75.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.85%. Comparing base (3a0186e) to head (68d255e).
⚠️ Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
pymc/distributions/continuous.py 66.66% 4 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #7916      +/-   ##
==========================================
- Coverage   91.47%   86.85%   -4.63%     
==========================================
  Files         116      116              
  Lines       18947    18929      -18     
==========================================
- Hits        17332    16441     -891     
- Misses       1615     2488     +873     
Files with missing lines Coverage Δ
pymc/distributions/moments/means.py 0.00% <ø> (-100.00%) ⬇️
pymc/logprob/transforms.py 95.43% <100.00%> (+0.02%) ⬆️
pymc/distributions/continuous.py 67.69% <66.66%> (-30.56%) ⬇️

... and 10 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ricardoV94
Copy link
Member

I moved this approach to #7956

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.

2 participants