lnccbrown / lnccbrown/HSSM

tests: batch of small measured trims (~5–8 min slow suite, ~1–2 min fast suite)

Open
#1,081 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

chore
Dominant language
Python
Stars
124
Forks
24
Avg merge
19h 32m
Merged PRs (30d)
60

Description

Small, independent trims with measured costs (per-test durations from run 29419740259, py3.12). Each can be its own small PR (or a few grouped); every PR should paste before/after `--durations` numbers.

- [ ] **`tests/test_initvals.py::test_sample_map`** — 12 parametrizations sample the full ~4000-row cavanagh dataset incl. `find_MAP`, with no assertions beyond "it ran" (195 s total). Subsample the data (~500 rows) and add a real assertion that MAP-based initvals were applied. → ~60 s.
- [ ] **`tests/test_hssm.py::test_resampling`** — 40.6 s of two real MCMC runs to assert trace-identity semantics (`_inference_obj` replaced vs reused). Assert the semantics with an attached precomputed idata + a mocked sampler instead. → seconds.
- [ ] **`tests/test_save_load.py::test_save_load_vi_mcmc`** — 28.8 s of live numpyro + double ADVI to test file round-tripping (related: #894 reports hangs here). Attach precomputed idata / tiny VI result; round-tripping doesn't need real inference. → seconds.
- [ ] **`tests/slow/test_missing_data_and_deadline_vi.py`** — uses `niter=1000` where the sibling VI files use `niter=100`, with identical isinstance-only assertions. Align to 100. → ~1.5 min.
- [ ] **`tests/slow/test_missing_data_and_deadline_mcmc.py`** — builds a *second* HSSM model per grid row solely to assert a construction-time ValueError. Hoist into one dedicated non-parametrized test. → ~40–80 s.
- [ ] **`tests/addm/test_addm_subclass.py`** — unmarked real-MCMC tests currently run in the fast PR suite (~1–2 min per fast job × 3 Pythons × every PR push). Add `@pytest.mark.slow`.
- [ ] **`tests/test_plotting.py`** — the 3 `predictive_style` parametrizations rebuild the model and re-sample an identical 2-draw posterior predictive. Share via fixture. → ~20 s.
- [ ] **aDDM cartoon/PPC/continuation tests** (`tests/addm/test_addm_cartoon.py` 64 s, `test_addm_ppc.py` 52 s, `test_addm_continuation.py` 48 s) — each rebuilds + compiles + samples the same throwaway aDDM fit. Share a module/package-scoped fixture or a canned `.nc` posterior (pattern: `tests/fixtures/idata_cavanagh_cartoon.nc`). → ~80–100 s saved.

Combined estimate: ~5–8 min per slow run, plus ~1–2 min off every fast PR job.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by selecting one independent item from the named test files, then run the relevant tests with pytest's `--durations` reporting to confirm the baseline. Read the existing fixtures and assertions, especially `tests/fixtures/idata_cavanagh_cartoon.nc` where relevant. Done means the selected test still verifies its stated behavior and the issue's measured before/after runtime improvement is pasted in the PR.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
performance, testing-qa
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.