Skip to content

Improve support for missingness in Filters/Smoothers#235

Open
mattlevine22 wants to merge 4 commits into
mainfrom
ml-missingness-tutorial-1
Open

Improve support for missingness in Filters/Smoothers#235
mattlevine22 wants to merge 4 commits into
mainfrom
ml-missingness-tutorial-1

Conversation

@mattlevine22
Copy link
Copy Markdown
Collaborator

This PR adds early missing-observation validation for filtering and smoothing, documents missingness support directly on the filter/smoother config classes, and stabilizes the continuous-time hierarchical simulator/discretizer smoke fixtures so they no longer generate accidental NaN rollouts. Unsupported missing-observation paths now fail early with clear messages: cuthbert KFConfig, EnKFConfig, and KFSmootherConfig remain the supported discrete-time NaN paths, while cuthbert EKF/EKFSmoother and CD-Dynamax filter/smoother paths are rejected cleanly.

It also adds missing-observation regression coverage in tests/test_missing_observations.py, updates the filter/smoother config docs in dynestyx/inference/filter_configs.py and dynestyx/inference/smoother_configs.py to state whether each backend supports missing observations via NaNs, and includes the new 11_missing_observations.ipynb tutorial in the docs navigation via mkdocs.yml.

@mattlevine22 mattlevine22 requested a review from DanWaxman May 21, 2026 15:16
Comment thread dynestyx/inference/checkers.py Outdated
Comment on lines +29 to +44
def _raise_if_missing_detected(
obs_values: Real[Array, "*obs_value_plate obs_time observation_dim"]
| Real[Array, "*obs_value_plate obs_time"],
has_missing,
message: str,
) -> None:
"""Raise plainly when possible; fall back to eqx.error_if under tracing."""
try:
missing_now = bool(has_missing)
except jax.errors.TracerBoolConversionError:
_ = eqx.error_if(obs_values, has_missing, message)
return

if missing_now:
raise ValueError(message)

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.

This feels weird as a separate helper function. I understand it does the tracing thing, but that is much more general as helper.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

ok, generalized it (and allow warning, which codex says can't have the same except trick)

Comment thread dynestyx/inference/filter_configs.py Outdated
Comment on lines +235 to +236
Does not support missing observations (data cannot have NaNs).

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.

I don't think this is strictly true; it's up to the user to specify transition and observation functions that work okay with NaNs, though.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

okay, I have PF do a warning, and changed the docstring to explain what you said.

@mattlevine22 mattlevine22 requested a review from DanWaxman May 22, 2026 17:26
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