Skip to content

Derive censoring logprob from min max operations#8363

Draft
ricardoV94 wants to merge 2 commits into
pymc-devs:mainfrom
ricardoV94:censoring_by_another_name
Draft

Derive censoring logprob from min max operations#8363
ricardoV94 wants to merge 2 commits into
pymc-devs:mainfrom
ricardoV94:censoring_by_another_name

Conversation

@ricardoV94

Copy link
Copy Markdown
Member
  • Infer logprob of maximum/minimum censoring
  • Infer logprob of trunc and round_half_away_from_zero rounding

maximum(x, c) and minimum(x, c) with a single measurable operand are
rewritten to one-sided clips (both-measurable graphs are order
statistics and are not claimed), reusing the existing clip machinery
for the discrete and continuous cases alike. The unbounded side uses
the measurable variable itself as its bound, which find_measurable_clips
already understood as one-sided clipping and which, unlike +-inf
constants, does not upcast discrete variables (previously one-sided
clips of discrete variables failed to be claimed for this reason).
Whether each side is bounded is decided once at claim time and stored
on the MeasurableClip op.

Clips of clips are fused eagerly into a single clip by combining the
bounds with maximum/minimum (constant bounds fold), so two-sided
censoring like maximum(minimum(x, ub), lb) becomes one node.
logcdf/icdf are also implemented for clipped variables (the point
masses at the bounds absorb the tail quantiles).
Truncation towards zero is the interval [x, x+1) for positive values,
(x-1, x] for negative ones, and (-1, 1) pooled at zero. Rounding half
away from zero shares the intervals of round half to even, since the
tie-breaking rule only differs on a measure-zero set of the continuous
base variable.
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 pymc | 🛠️ Build #33594984 | 📁 Comparing 64e51bf against latest (b3033da)

  🔍 Preview build  

1 file changed
± glossary.html

@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.46154% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 91.75%. Comparing base (b3033da) to head (64e51bf).

Files with missing lines Patch % Lines
pymc/logprob/censoring.py 98.46% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #8363      +/-   ##
==========================================
+ Coverage   91.73%   91.75%   +0.01%     
==========================================
  Files         128      128              
  Lines       20697    20745      +48     
==========================================
+ Hits        18987    19034      +47     
- Misses       1710     1711       +1     
Files with missing lines Coverage Δ
pymc/logprob/censoring.py 97.76% <98.46%> (+0.08%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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