lnccbrown / lnccbrown/HSSM

[Migration] Drop the constant parameters and *_Intercept_centered RVs bambi 0.20 keeps in posterior

Open
#1,330 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
124
Forks
24
Avg merge
19h 32m
Merged PRs (30d)
60

Description

Part of #1305. Parent: #1306.

⚠️ **Unmasked by #1313** — these ids were hidden under the R5 mark until `sample()` worked again.

bambi 0.20 records two kinds of variables in `posterior` that the old bambi never stored:

- every constant marginal parameter is built as a `pm.Deterministic` and traced — `p_outlier=0.05`, a fixed `z=0.5`, and the `0.0` placeholder HSSM uses for a fixed-vector parameter;
- the `*_Intercept_centered` RV is kept alongside the uncentered `*_Intercept` deterministic ([bambi#1002](https://github.com/bambinos/bambi/pull/1002), *Predictor centering and the intercept*: "The intercept on the original scale is now a deterministic variable in the model").

```
assert "v" not in idata.posterior.data_vars # fixed-vector v recorded as 0.0
assert summary.shape[0] == 4 # 5: p_outlier is a row now
assert summary.shape[0] == 6 # 8: + p_outlier, v_Intercept_centered
```

So `az.summary` / `plot_trace` gain rows and fixed-vector parameters show up in the trace as a constant.

### Tasks
- [ ] Decide whether `_clean_posterior_group` (`src/hssm/base.py:900`) should drop constant deterministics and `*_centered` RVs, or whether this is an `omit_offsets`-style opt-in
- [ ] Coordinate with #1314, which touches the same function (`distributional_components` → `conditional_parameters`)
- [ ] Remove the R13 xfail marks

### Impact
5 test ids across 2 files: `tests/test_hssm.py::TestFixedVectorParams` (2), `tests/integration/test_mcmc.py::test_post_processing_*` (3).

Details: `design/bambi-dev-upgrade-test-failures.md` (R13), `design/bambi-migration-fix-plan.md` (F12).

Contributor guide

Open the contributing guide

Research direction

Start with _clean_posterior_group in src/hssm/base.py:900 and review design/bambi-dev-upgrade-test-failures.md (R13) and design/bambi-migration-fix-plan.md (F12). Coordinate the decision with #1314, then run the five affected tests in tests/test_hssm.py::TestFixedVectorParams and tests/integration/test_mcmc.py::test_post_processing_*; done means the expected posterior shapes and variables pass without the R13 xfails.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.