Skip to content

Add logccdf to LogNormal distribution#8166

Merged
ricardoV94 merged 1 commit into
pymc-devs:v6from
vybhav72954:feature/logccdf
Mar 24, 2026
Merged

Add logccdf to LogNormal distribution#8166
ricardoV94 merged 1 commit into
pymc-devs:v6from
vybhav72954:feature/logccdf

Conversation

@vybhav72954
Copy link
Copy Markdown
Contributor

Description

Adds an explicit logccdf (log survival function) to LogNormal using normal_lccdf(mu, sigma, log(t)) from dist_math.py, consistent with Normal.logccdf.

Unlike Weibull/Exponential, where the direct logccdf is just the logcdf intermediate minus the log1mexp wrapper (which PyTensor's graph optimizer already rewrites), LogNormal's logccdf calls a genuinely different function (normal_lccdf vs normal_lcdf), so an explicit registration is warranted.

Also adds a check_logccdf test helper to pymc/testing.py, mirroring check_logcdf, to support testing logccdf across distributions.

Changes

  • pymc/distributions/continuous.py: Add logccdf to LogNormal
  • pymc/testing.py: Add check_logccdf helper and logccdf import
  • tests/distributions/test_continuous.py: Add test_lognormal_logccdf

Related Issue

Checklist

Type of change

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

NOTE - I have created the PR on the v6 branch assuming that's the right one, if this should point to base, please let me know, and I will rebase accordingly!

TIA, happpy to discuss if there are any concerns!

@read-the-docs-community
Copy link
Copy Markdown

read-the-docs-community Bot commented Mar 4, 2026

Comment thread tests/distributions/test_continuous.py
@vybhav72954 vybhav72954 requested a review from ricardoV94 March 6, 2026 10:18
@ricardoV94
Copy link
Copy Markdown
Member

Looks great @vybhav72954

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 6, 2026

Codecov Report

❌ Patch coverage is 90.47619% with 4 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (v6@8305de8). Learn more about missing BASE report.

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

Impacted file tree graph

@@          Coverage Diff          @@
##             v6    #8166   +/-   ##
=====================================
  Coverage      ?   91.49%           
=====================================
  Files         ?      124           
  Lines         ?    19958           
  Branches      ?        0           
=====================================
  Hits          ?    18261           
  Misses        ?     1697           
  Partials      ?        0           
Files with missing lines Coverage Δ
pymc/distributions/continuous.py 98.27% <100.00%> (ø)
pymc/testing.py 90.56% <89.74%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vybhav72954
Copy link
Copy Markdown
Contributor Author

@ricardoV94 Can you please guide me if anyhting further is requried from my end to get this PR merged, thank you!

@vybhav72954
Copy link
Copy Markdown
Contributor Author

Hi @ricardoV94 please let me know if anything further is required from my end in this PR, happy to make any adjustments in case i have missed anything

@ricardoV94 ricardoV94 merged commit b66b6a9 into pymc-devs:v6 Mar 24, 2026
42 checks passed
@welcome
Copy link
Copy Markdown

welcome Bot commented Mar 24, 2026

Congratulations Banner]
Congrats on merging your first pull request! 🎉 We here at PyMC are proud of you! 💖 Thank you so much for your contribution 🎁

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ENH: Add direct logccdf to LogNormal distribution

2 participants