feat(bgm): dimension-adaptive auto-default for the determinant tilt#107
Merged
Conversation
bgm() and sample_ggm_prior() gain a NULL sentinel for the `delta` argument that resolves to 0.5 * log(p), where p is the dimension of the continuous precision matrix. The rule is the simple form of the dimension-adaptive scaling delta(p) = c * log(p) with c in (0.3, 0.6) discussed in the companion paper on determinant-tilted spike-and-slab priors (Marsman et al., in preparation), sec:tilt-empirics: constant delta drifts off-target with p (delta = 1 stays above target median lambda_min only up to p ~ 50), while the log-linear rule maintains a target prior boundary distance uniformly in p. The resolver runs after model_type is finalized in bgm_spec(): - GGM: p = num_variables. - Mixed MRF: p = number of continuous variables. - OMRF / compare: no continuous block, NULL resolves to 0. Explicit `delta = 0` recovers the untilted prior (companion-paper baseline); pass any other non-negative numeric to override. Three GGM SBC tests (NUTS, MH, MH+ES) and the M.2J mixed-MRF NUTS diagnostics test now pass `delta = 0` explicitly to preserve their original calibration -- their prior generators and zero-divergence expectation assume the untilted prior. Other tests use the new auto-default and pass unchanged.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #107 +/- ##
==========================================
+ Coverage 87.34% 87.42% +0.07%
==========================================
Files 77 77
Lines 13441 13450 +9
==========================================
+ Hits 11740 11758 +18
+ Misses 1701 1692 -9 ☔ View full report in Codecov by Sentry. 🚀 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.
Summary
Implements Stage 1 of dev/plans/backlog/hierarchical-ggm-degord-rr.md: a dimension-adaptive auto-default for the
deltaargument.bgm()andsample_ggm_prior()now acceptdelta = NULL(the new default), which resolves towhere$p$ is the dimension of the continuous precision matrix. This is the simple form of the dimension-adaptive scaling $\delta(p) = c \cdot \log p$ with $c \in (0.3, 0.6)$ established in the companion paper on determinant-tilted spike-and-slab priors (Marsman et al., in preparation). The rule keeps the prior bulk in the positive-definite cone interior uniformly in $p$ , whereas constant $\delta$ drifts off-target and the G-Wishart-style linear rule $(q-2)/2$ overshoots.
At common dimensions the auto-default produces sensible values:
Changes
R/bgm.R: signaturedelta = 0→delta = NULL; roxygen documents the auto-default, the companion-paper motivation, and the explicit override path.R/bgm_spec.R: signaturedelta = 0→delta = NULL; resolver added aftermodel_typeis finalized. Routing:R/sample_ggm_prior.R: same treatment; GGM-only so the resolver is simplyman/bgm.Rdandman/sample_ggm_prior.Rdviadevtools::document().delta = 0for their original calibration (3 GGM SBC tests + M.2J mixed-MRF NUTS diagnostics) now passdelta = 0explicitly. Their prior generators sample from the untilted prior; explicitdelta = 0preserves the test's calibration.Behavior change
Users who previously called
bgm()orsample_ggm_prior()without specifyingdeltaget the tilted prior by default. Reproducibility note: chains with the sameseedwill differ from previous versions; passdelta = 0to recover identical behavior.Test plan
sample_ggm_prior(p = 4, delta = NULL)resolves tosample_ggm_prior(p = 4, delta = 0)continues to work (explicit untilted).sample_ggm_prior(p = 4, delta = -1)errors with a clear message.sbc-ggm|parameter-recovery-ggm|ggm-nuts|mixed-nuts|scaling-diagnostics): all pass after the four targeted patches.Companion / next stage
Stage 2 follows:
sample_ggm_prior(spec = "joint")for joint-specification SBC. The auto-default exposed here applies in either spec.