-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Split discrete and continuous Kalman filter implementations #645
Split discrete and continuous Kalman filter implementations #645
Conversation
Codecov Report
@@ Coverage Diff @@
## main #645 +/- ##
==========================================
+ Coverage 90.12% 90.26% +0.13%
==========================================
Files 194 194
Lines 7353 7343 -10
Branches 1163 1160 -3
==========================================
+ Hits 6627 6628 +1
+ Misses 486 470 -16
- Partials 240 245 +5
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
regression_problem: problems.TimeSeriesRegressionProblem, | ||
_previous_posterior: Optional[_timeseriesposterior.TimeSeriesPosterior] = None, | ||
): | ||
def filter(self, *args, **kwargs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This wrapper around the state generator works with args and kwargs for the following reason:
Soon, the regression problems might change types (discrete vs continuous), and the filter() and iterated_filtsmooth_generator() signature adapts accordingly. But this function here (and the filtsmooth() style methods below) remains the same. args and kwargs lead to a smaller, more meaningful diff in the future.
In a Nutshell
Splits the current
Kalman
implementation into a discrete and a continuous part. TheDiscreteKalman
does Gaussian filtering and smoothing for discrete-discrete state-space models. TheContinuousKalman
does the same for continuous-discrete state-space models. The goal of this PR is to make another step towards easier-to-maintain filtering and smoothing code.(This PR also does some first mini-steps in simplifying the filter() implementation in the discrete object.)
Detailed Description
The filter() and smooth() functions in the Kalman filter currently carry around a lot of dead weights for discrete models. Most notably, a
dt
variable, which does not make sense. (Also, thet
variable is pointless, but this can only be refactored as a part of a bigger effort; detailed in #627.)Soon, when there are suitable priors/problem classes for discrete vs continuous state-space models (see also #646), and when approximate Kalman filters are refactored, the gains obtained through the separation introduced here will be even more evident.
Some further changes:
filtsmooth.gaussian.optim
)