Skip to content

Make the wider-range network the angle model - #1530

Merged
AlexanderFengler merged 17 commits into
mainfrom
1529-angle-wider-range-primary
Nov 28, 2026
Merged

AlexanderFengler merged 17 commits into
mainfrom
1529-angle-wider-range-primary

Conversation

@AlexanderFengler

@AlexanderFengler AlexanderFengler commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Spine plan: https://github.com/lnccbrown/HSSMSpine/blob/main/plans/angle-wider-range-primary.md#pr-stack (step H1)
Depends on: lnccbrown/ssm-simulators#455 (M1, merged), the ssm-simulators 0.17.0 release (R), and #1457, which this branch is stacked on
Unblocks: P1 (the paper notebooks)

Closes #1529

🤖 Generated with Claude Code

sim and others added 14 commits November 6, 2026 10:24
A parameter named shape (gamma_drift, gamma_drift_angle) was read as PyMC's shape keyword, so the response was built as a single trial.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t shape -> k (#1456)

make_distribution now refuses a parameter named after a pm.Distribution
keyword (shape, size, name, observed, dims, ...) with an error that asks
for a rename. gamma_drift and gamma_drift_angle call their gamma shape
parameter k, matching ssm-simulators. With the check in place, passing
parameters to PyMC by position no longer guards anything, so that change
is reverted. HSSM(...) now names the model's parameters when a keyword is
neither a parameter nor a bambi.Model argument.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A parameter fixed to a vector reaches Bambi, and so the RV, as a scalar
0.0 placeholder; only HSSMDistribution.logp() put the vector back.
sample_posterior_predictive, sample_prior_predictive and sample_do
therefore simulated every row with 0.0 for that parameter.

- make_hssm_rv takes the fixed vectors, and rng_fn simulates with them,
  broadcast against the other parameters, one value per row.
- sample_posterior_predictive(data=...) with kind="response" raises a
  ValueError for such models unless data is the model's own data, since
  the vector has no values for other rows.
- Add tests and changelog item 24.

Claude helped me with this change.
…#1453)

rng_fn takes p_outlier out of the parameters before broadcasting them, so a
p_outlier fixed to a vector kept its (n_obs,) shape and _apply_lapse_model
could not reshape it to the draws. Broadcast it to the same shape, and test
that each row gets its own lapse probability.

Claude helped me with this change.
- predict() applies the same new-data check as
  sample_posterior_predictive.
- The check compares the values of the columns data shares with
  model.data, so the index, dtypes and extra columns no longer make the
  model's own rows look new. The error says that reordered rows also fail.
- A broadcasting error is blamed on the fixed vector only when the other
  parameters broadcast with each other.
- make_distribution logs a warning when rv is a RandomVariable, whose
  rng_fn cannot receive the fixed vectors.
- RLSSM and aDDM raise NotImplementedError for a parameter fixed to a
  vector: they used 0.0 in its place, in the likelihood too.
- Correct the changelog entry.
…ard (#1453)

- Bambi 0.19 and 0.20 accept kind="pps", a deprecated alias of
  "response", so the new-data check covers it too.
- _has_same_rows compares the missing-value masks, then the other
  values, so NaN in an object column no longer makes the model's own rows
  look different.
Conflicts:
- docs/changelog.md: main's items 19-34 kept; this PR's entry moves from
  19 to 35 and its migration note becomes breaking change 3. The entry no
  longer names ssm-simulators 0.16.0 as the release with the rename
  (0.16.0 shipped without it); it says "its first release after 0.16.0".
- tests/distribution_utils/test_distribution_utils.py: both sides' new
  tests kept; the reserved-name test follows main's.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- Keep the isinstance checks in make_distribution's branches so that mypy
  narrows `rv`.
- Raise NotImplementedError for a parameter fixed to a vector when `loglik`
  is a pm.Distribution class, which receives the 0.0 placeholder.
- Compare only the columns the model reads (response, formula variables,
  extra fields) when checking `data` for fixed vectors, name the first
  column that differs, and raise when `data` shares none of them.
Conflicts: the base.py imports (keep both: this branch uses formulae.model_description, main bambi.utils.get_aliased_name) and the changelog entry number, now after the entries main added.
Conflicts with #1266: make_hssm_rv and make_distribution keep both fixed_vector_params and expected_obs_dim, in main's merged str-or-callable branch; RLSSM keeps _validate_fixed_vectors, and _validate_choice_only_responses stays removed as in main.
…-params

Chains the open 0.5.1 pull requests so that they merge back to back: this branch now contains #1502 and the pull requests before it (#1448, #1450, #1455, #1454), and its changelog entry is item 43. The entry loses the sentence on reordered rows, which #1455 makes obsolete.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Brings in main and the six chained fixes (#1448, #1450, #1455, #1454, #1502,
#1503). The changelog entry of this branch becomes item 44. In dist.py the
reserved-name check and the ready-made RandomVariable warning both stay.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The first release in which gamma_drift and gamma_drift_angle call their gamma
shape k (lnccbrown/ssm-simulators#449).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
angle loads angle_extended.onnx and declares v in (-6, 6), the box
ssm-simulators 0.17.0 gives it. angle_extended becomes a deprecated name:
it builds angle, warns, and leaves hssm.list_models(). The legacy RLDM
likelihood and two tutorial examples follow the config.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@review-notebook-app

Copy link
Copy Markdown

Review Notebooks

Notebooks changed:

Review visual diffs and comment on any notebook cell. All comments sync back to this PR.


Powered by ReviewNB

@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 48 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b93e7cd0-f44d-4919-82de-513119775a22
Commits

Reviewing files that changed from the base of the PR and between f21350d and 94cd05c.

Files selected for processing: 26

  • docs/changelog.md
  • docs/reference/models-and-likelihoods.md
  • docs/tutorials/main_tutorial_scenic_route.ipynb
  • docs/tutorials/main_tutorial_scenic_route.py
  • pyproject.toml
  • src/hssm/_types.py
  • src/hssm/addm/addm.py
  • src/hssm/base.py
  • src/hssm/distribution_utils/dist.py
  • src/hssm/hssm.py
  • src/hssm/likelihoods/rldm_optimized.py
  • src/hssm/modelconfig/__init__.py
  • src/hssm/modelconfig/angle_config.py
  • src/hssm/modelconfig/angle_extended_config.py
  • src/hssm/modelconfig/gamma_drift_angle_config.py
  • src/hssm/modelconfig/gamma_drift_config.py
  • src/hssm/param/params.py
  • src/hssm/rl/rlssm.py
  • tests/addm/test_addm_subclass.py
  • tests/distribution_utils/test_distribution_utils.py
  • tests/rl/test_registry.py
  • tests/rl/test_rlssm.py
  • tests/test_hssm.py
  • tests/test_modelconfig.py
  • tests/test_sample_posterior_predictive.py
  • tests/unit/likelihoods/test_rldm_optimized.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

AlexanderFengler added a commit that referenced this pull request Nov 27, 2026
…to feat/register-full-ddm-lan

One conflict, in tests/test_modelconfig.py: the registry test's model list
takes `angle` from #1530 (`angle_extended` is now a deprecated name) and
keeps `full_ddm_lan` from this branch.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@AlexanderFengler
AlexanderFengler marked this pull request as ready for review November 27, 2026 17:42
@AlexanderFengler
AlexanderFengler changed the base branch from 1456-shape-param-collision to main November 27, 2026 18:11
AlexanderFengler and others added 3 commits November 27, 2026 14:07
The branch had merged a newer main than the five PRs chained before it, so
after those were merged GitHub saw two merge bases and reported a conflict.
With main merged in, the merge base is main's tip. No content conflict; the
tree is the one the chain was tested with.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Keeps the 0.5.1 chain mergeable on GitHub: each branch contains main and the
branch before it, so there is one merge base at every step. No content
change beyond what main and #1503 already contain.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Keeps the 0.5.1 chain mergeable on GitHub: each branch contains main and the
branch before it, so there is one merge base at every step. No content
change beyond what main and #1457 already contain.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
AlexanderFengler added a commit to EItanm1999/HSSM that referenced this pull request Nov 27, 2026
Keeps the 0.5.1 chain mergeable on GitHub: each branch contains main and the
branch before it, so there is one merge base at every step. No content
change beyond what main and lnccbrown#1530 already contain.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@AlexanderFengler
AlexanderFengler merged commit b4b79a3 into main Nov 28, 2026
7 checks passed
AlexanderFengler added a commit that referenced this pull request Nov 28, 2026
…m_defaults (#1529)

HSSM(...) and get_default_model_config map `angle_extended` to `angle` with
a FutureWarning, but a direct Config.from_defaults("angle_extended", None)
raised the custom-model error, and with a loglik_kind it kept the old name.
The classmethod now resolves the name first. Raised by CodeRabbit on #1518,
#1439 and #1532; the alias itself came in with #1530.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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.

Make the wider-range network the angle model; deprecate the name angle_extended

2 participants