Add Discrete-Time Filtering via cuthbert#60
Merged
mattlevine22 merged 23 commits intomainfrom Feb 4, 2026
Merged
Conversation
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.
mattlevine22
reviewed
Feb 3, 2026
Collaborator
mattlevine22
left a comment
There was a problem hiding this comment.
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, | |||
Collaborator
There was a problem hiding this comment.
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)
Collaborator
Author
There was a problem hiding this comment.
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.
mattlevine22
reviewed
Feb 4, 2026
mattlevine22
reviewed
Feb 4, 2026
mattlevine22
reviewed
Feb 4, 2026
Collaborator
mattlevine22
left a comment
There was a problem hiding this comment.
- Should move
dsx_to_cd_dynamaxtoinference/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
approved these changes
Feb 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds integration with
cuthbertfor discrete-time filtering, along with some other refactoring changes made along the way for clarity. Namely:FilterBasedMarginalLogLikelihood; this became necessary, especially ascuthbertintegration was added, which uses different fields. Now, all are handled infilter_kwargs, which should be better documented (raises More Transparent API for Filter kwargs #59).