Skip to content

Fix DirichletCollection default-space logpartition (closes #300) - #309

Open
bvdmitri wants to merge 2 commits into
mainfrom
fix/dirichletcollection-default-logpartition
Open

Fix DirichletCollection default-space logpartition (closes #300)#309
bvdmitri wants to merge 2 commits into
mainfrom
fix/dirichletcollection-default-logpartition

Conversation

@bvdmitri

@bvdmitri bvdmitri commented Sep 2, 2026

Copy link
Copy Markdown
Member

Closes #300.

Problem

getlogpartition(DefaultParametersSpace(), DirichletCollection, conditioner) mapped over the flattened parameter vector element-by-element and fed each scalar to the multivariate Dirichlet log-partition. For a scalar, loggamma(x) - loggamma(x) = 0, so the whole thing identically returned 0 regardless of input.

Fix

Slice the flat vector per-distribution and sum the per-slice Dirichlet log-partition — mirroring the natural-space getlogpartition and the existing default-space getgradlogpartition in 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 constant 0) across matrix and tensor shapes.

Reported by @docxology.

bvdmitri and others added 2 commits September 2, 2026 12:05
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

codecov Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.14%. Comparing base (a72e447) to head (b8f516f).

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.
📢 Have feedback on the report? Share it here.

🚀 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.

Issue 11 — DirichletCollection default-space getlogpartition returns 0

1 participant