Skip to content

Add Discrete-Time Filtering via cuthbert#60

Merged
mattlevine22 merged 23 commits intomainfrom
dw-cuthbert
Feb 4, 2026
Merged

Add Discrete-Time Filtering via cuthbert#60
mattlevine22 merged 23 commits intomainfrom
dw-cuthbert

Conversation

@DanWaxman
Copy link
Collaborator

This PR adds integration with cuthbert for discrete-time filtering, along with some other refactoring changes made along the way for clarity. Namely:

This adds cuthbert support using the Taylor submodule, which is just doing an EnKF I think. Subsequent commits will work with additional inference methods.
We add in particle filters, add defaults, and properly separate continuous and discrete filtering methods.

This also adds a small patch to cuthbert to ensure differentiability.
They accepted my PR :)
Fixes #58)

Types are kinda messed up right now, so this is mostly a lot of type ignores. These should be resolved, but potentially as a separate PR.
@DanWaxman DanWaxman linked an issue Feb 3, 2026 that may be closed by this pull request
Copy link
Collaborator

@mattlevine22 mattlevine22 left a comment

Choose a reason for hiding this comment

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

Looks good.

  • I ran the new science tests, and look good.
  • Biggest ask here is to shorten FilterBasedMarginalLogLikelihood, and move most of its code to 2 util files (for discrete and continuous time)
  • Some naming issues where you write PF, but are actually running taylor_kf...I think I caught them
  • We do support EKF and UKF through CD-Dynamax, so just add those strings back in---should work without any additional changes (as long as filter kwargs didn't get dropped).

@@ -35,7 +49,13 @@ def __init__(
state_dim: Optional[int] = None,
observation_dim: Optional[int] = None,
control_dim: Optional[int] = None,
continuous_time: bool = False,
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we omit continuous_time from the init but still have it in the class definition?

Its presence here will be confusing to a user, and is never used (state_evolution always has a type, can't be None)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Unfortunately not because of how the eqx modules work

This adds new integration subpackages. For now, these live in `dynestyx/inference/<integration>/<...>.py`, and include continuous and discrete time filters. This makes the base `filters.py` much more wieldy.
This introduces stricter linting rules, useful for things like unused imports or performance issues.
Copy link
Collaborator

@mattlevine22 mattlevine22 left a comment

Choose a reason for hiding this comment

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

  • Should move dsx_to_cd_dynamax to inference/cd_dynamax
  • Found one remaining bug in a list missing ['ekf', 'ukf']

This streamlines use a bit and properly separates cd_dynamax utils from the rest of the library.
Continuous-time features which would have used an EnKF previously now use all the Gaussian filters.

This may lead to some instabilities for certain methods (EKF bad...).
EKF too bad performance. Make sure unapcking shapes are right.
@mattlevine22 mattlevine22 merged commit 625f2fa into main Feb 4, 2026
2 checks passed
@DanWaxman DanWaxman deleted the dw-cuthbert branch March 11, 2026 16:09
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.

Add plumbing for discrete-time cuthbert algorithms Discrete-time Particle Filter in CD-Dynamax

2 participants