Skip to content

Research: isolate hierarchical TruncatedNormal density and parameterization effects - #1294

Draft
AlexanderFengler wants to merge 4 commits into
codex/1282-qualify-truncated-hierarchyfrom
codex/1282-tn-causal-oracle
Draft

Research: isolate hierarchical TruncatedNormal density and parameterization effects#1294
AlexanderFengler wants to merge 4 commits into
codex/1282-qualify-truncated-hierarchyfrom
codex/1282-tn-causal-oracle

Conversation

@AlexanderFengler

@AlexanderFengler AlexanderFengler commented Sep 1, 2026

Copy link
Copy Markdown
Member

Summary

This is the first causal child of #1288 for #1282. It adds an independent second-order oracle and five exactly equivalent representations of one hierarchical TruncatedNormal model:

  • native centered PyMC;
  • manual centered density plus explicit Jacobians;
  • location-only inverse-CDF non-centering with centered group effects;
  • group-only inverse-CDF non-centering with a centered location;
  • full inverse-CDF non-centering.

The four coordinate forms complete the 2×2 intervention on location centering and group-effect centering. The manual centered form is an implementation control. The oracle uses only the standard library, NumPy, and SciPy. The model tests compare full transformed log density, gradient, and Hessian against that oracle under PyTensor and genuine JAX autodiff.

What this establishes

For the declared lower-only and finite-bound cases, all five representations encode the same natural model and agree numerically through second order. During review, the new regressions also found and fixed two defects in the research alternatives themselves: ordinary-probability tail underflow and an incorrect JAX subgradient at the log-CDF branch point.

This PR does not sample, qualify hierarchical TruncatedNormal defaults, alter HSSM production code, or authorize merging the rejected default experiment from #1277. Its output is the controlled substrate for the next causal sampling experiment.

Validation

  • 125 focused tests passed in the frozen Python 3.12 / PyMC 6.3.1 / PyTensor 3.3.0 / JAX 0.11.1 environment;
  • all ten builder-by-bound oracle comparisons passed for PyTensor and actual JAX value, gradient, and Hessian;
  • extreme lower, finite-right, and finite-left tail regressions passed after ordinary CDF underflow;
  • Ruff check and format passed;
  • mypy and Pyrefly passed;
  • independent read-only review found no remaining correctness blocker;
  • frozen v2 harness and evidence files are unchanged.

Next experiment

A follow-up child will run the same data, natural-scale starts, and sampler randomization across all five representations. The predeclared 2×2 classifier can then distinguish location-centering, group-conditional-centering, their interaction, native graph/adaptation behavior, backend specificity, and residual TruncatedNormal geometry.

Closes no issue. Research tracker: #1282.

@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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