Fix DirichletCollection default-space logpartition (closes #300) - #309
Open
bvdmitri wants to merge 2 commits into
Open
Fix DirichletCollection default-space logpartition (closes #300)#309bvdmitri wants to merge 2 commits into
bvdmitri wants to merge 2 commits into
Conversation
The default (mean) parameter-space log-partition mapped over the flattened parameter vector element-by-element, feeding scalars to the multivariate Dirichlet log-partition (loggamma(x) - loggamma(x) = 0), so it identically returned 0. Slice per-distribution instead, mirroring the natural-space implementation and the existing default-space gradient. Adds a regression test asserting default-vs-natural consistency. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #309 +/- ##
==========================================
+ Coverage 83.91% 84.14% +0.23%
==========================================
Files 45 45
Lines 4078 4088 +10
==========================================
+ Hits 3422 3440 +18
+ Misses 656 648 -8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Closes #300.
Problem
getlogpartition(DefaultParametersSpace(), DirichletCollection, conditioner)mapped over the flattened parameter vector element-by-element and fed each scalar to the multivariateDirichletlog-partition. For a scalar,loggamma(x) - loggamma(x) = 0, so the whole thing identically returned0regardless of input.Fix
Slice the flat vector per-distribution and sum the per-slice Dirichlet log-partition — mirroring the natural-space
getlogpartitionand the existing default-spacegetgradlogpartitionin the same file.Test
Adds
DirichletCollection: default-space logpartition consistency, asserting the default-space log-partition equals the natural-space one (and is not the previous constant0) across matrix and tensor shapes.Reported by @docxology.