Skip to content

Adding jaxtyping and small shape improvements to inference - #293

Open
mattlevine22 wants to merge 2 commits into
mainfrom
ml-jaxtyping
Open

Adding jaxtyping and small shape improvements to inference#293
mattlevine22 wants to merge 2 commits into
mainfrom
ml-jaxtyping

Conversation

@mattlevine22

Copy link
Copy Markdown
Collaborator
  • Add jaxtyping across Filter/Smoother inference.
  • Canonicalize scalar observation/control series from (T,) to (T, 1).
  • Preserve (T,) scalar labels for HMMs.

…alues to have final dimension even if scalar
@mattlevine22
mattlevine22 requested a review from DanWaxman July 31, 2026 05:57
Comment thread dynestyx/inference/filters.py Outdated
Comment on lines +279 to +288
if not isinstance(config, HMMConfigs):
obs_values = _ensure_trailing_event_axis(
obs_values,
plate_shapes=plate_shapes,
)
if ctrl_values is not None:
ctrl_values = _ensure_trailing_event_axis(
ctrl_values,
plate_shapes=plate_shapes,
)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex points out (and I agree) that this can be problematic to do before plating; for plate size M and time series length T, if M = T, then shared scalar controls (T,) get promoted to plated controls (T, 1), which gets interpreted as plated. We should either do this later, or raise an error in _ensure_trailing_event_axis for this (rather rare) edge case.

@mattlevine22
mattlevine22 requested a review from DanWaxman July 31, 2026 18:08
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.

2 participants