Add unnormalized log pdf functions - #187
Open
devmotion wants to merge 8 commits into
Open
Conversation
devmotion
force-pushed
the
dw/logupdf
branch
2 times, most recently
from
October 20, 2025 04:36
c740751 to
0a2d5c9
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #187 +/- ##
==========================================
+ Coverage 75.50% 77.72% +2.21%
==========================================
Files 23 23
Lines 1135 1239 +104
==========================================
+ Hits 857 963 +106
+ Misses 278 276 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
devmotion
force-pushed
the
dw/logupdf
branch
2 times, most recently
from
October 22, 2025 18:49
1f8060d to
3e61731
Compare
Contributor
|
@devmotion I just noticed you got started on this. Anything I can do to help it along? |
devmotion
force-pushed
the
dw/logupdf
branch
2 times, most recently
from
March 11, 2026 09:50
2dd01ad to
827b221
Compare
Member
Author
|
I had actually forgotten the PR, probably also since nobody reacted to it. I fixed the merge conflicts and applied a few fixes, so tests pass now. |
sethaxen
suggested changes
Mar 12, 2026
sethaxen
left a comment
Contributor
There was a problem hiding this comment.
The math/code all looks correct. Just some minor suggestions.
Co-authored-by: Seth Axen <seth@sethaxen.com>
devmotion
marked this pull request as ready for review
March 12, 2026 16:02
master (#221) removed the raw combinatorial counts from `signrank` and `wilcox`, normalising both recurrences in place to avoid `Int` overflow, while this branch had factored those counts out into `signrank_numsets` and `wilcox_numseqs` so that the unnormalized log pdfs could be `log(count)`. Since the normalisation is now folded into the recurrence seed, computing counts is neither cheaper nor more accurate than computing probabilities, and recovering `log(count)` by adding the constant back would reintroduce underflow (the sum is `-Inf` wherever the probability underflows, although `log(count)` is finite there) and cancellation. So `signranklogupdf` and `wilcoxlogupdf`, like the `logulikelihood` variants, just return the normalized log pdf -- the same fallback already used for `hyper`, `nbeta`, `nchisq`, `nfdist` and `ntdist`. Their tests move to the "fallback" testset accordingly. Note that `signrank.jl` merged cleanly but incorrectly: `signrank_numsets` returned master's already-normalised `DP[1]`, so `signrankpdf` divided by `2^n` a second time and `signranklogupdf` collapsed onto `signranklogpdf`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Resolve the conflicts introduced by the TestItems conversion (#209): - test/runtests.jl: take master's `@run_package_tests`; the "unnormalized" entry in the old `tests` array is obsolete now that items are auto-discovered. - test/chainrules.jl: keep master's `@testitem` wrapper and finite-difference margin comment, re-adding the `*logupdf`/`poislogulikelihood` rule tests at the new indentation. - test/unnormalized.jl: convert to `@testitem "Unnormalized optimized"` and `@testitem "Unnormalized fallback"`. Without this the file would no longer be collected by the runner and none of its tests would execute. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #185.