Skip to content
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

Refactoring of Markov processes and Kalman filters #627

Open
3 of 12 tasks
pnkraemer opened this issue Feb 9, 2022 · 0 comments
Open
3 of 12 tasks

Refactoring of Markov processes and Kalman filters #627

pnkraemer opened this issue Feb 9, 2022 · 0 comments
Assignees
Labels
filtsmooth Issues related to filtering and smoothing refactoring Refactoring of existing functionality

Comments

@pnkraemer
Copy link
Collaborator

pnkraemer commented Feb 9, 2022

Describe the issue

The current implementation of Markov processes and Kalman filters is agnostic of two rather important concepts:

  • Whether the underlying state-space model is discrete or continuous
  • Whether the prior or observation model is linear or nonlinear

The implementations are tied to a single MarkovProcess and Kalman class. The distinctions between the above settings are made by passing corresponding transitions and/or linearisation-wrappers to the MarkovProcess or the Kalman class.

This works fine, but has two major issues:

  • It is difficult to maintain, because unused variables are flying around. There is zero need for variables like t and dt in discrete transitions and discrete Kalman filters, and removing them wherever applicable will make the code much more readable.
  • It is difficult to maintain, because one has to jump back and forth between many files to track down an error in the code. The linearised information operators point to extended kalman filters which point to transitions which are then used in ODE filters etc. This can, and should, be made much clearer.
  • It is not clear how many features actually exist. The feature list implemented in filtsmooth is quite extensive: (non)iterated, discrete/continuous, kalman/ukf/ekf filters/smoothers and all combinations thereof are implemented, but it could be made much easier to use those.

Additional context

@schmidtjonathan did I miss anything?

Tasks

This will touch a lot of code in filtsmooth and randprocs.markov, so below I will try to compile a set of micro-PR-type tasks. I will edit freely as soon as I can come up with more. The tasks are not ordered.

  • Split the filtsmooth tutorial notebooks into smaller notebooks (4 instead of 2: linear/nonlinear, continuous/discrete filtering). Among other things, this will help with future notebook-merge-conflicts. (Linear filtering and smoothing) (Edit: Split filtsmooth notebooks #628)
  • Split the filtsmooth tutorial notebooks into smaller notebooks (4 instead of 2: linear/nonlinear, continuous/discrete filtering). Among other things, this will help with future notebook-merge-conflicts. (Nonlinear filtering and smoothing) (Edit: Split nonlinear filtering notebooks #644)
  • Split the Kalman filter implementation into a discrete and a continuous version
  • Make a MarkovSequence type class as a discrete counterpart to a MarkovProcess. This can then be passed to discrete filters
  • Refactor the UnscentedKalman componentes so that they propagate only via linearise(), i.e., they share an interface with EKF components. (Edit: Refactor UKF Components to use linearize() #635)
  • Implement ExtendedKalman, UnscentedKalman, etc., by subclassing the Kalman filters and wrapping nonlinearities into EKFComponents, UKFComponents, etc.. Make the latter private.
  • Replace _EKFComponents, _UKFComponents, etc., with pure functions linearise_ek/uk that turn a nonlinear model into a linear model.
  • Remove the inheritance of DiscreteTransitions from Transition. Rename the latter to SDETransition?
  • Remove the time-dependencies from discrete transitions
  • Consider eliminating forward_*, backward_*, etc. from the SDE models and perhaps handle everything via SDEModel.discretise() -> DiscreteTransition.?
  • Merge the linear, time-invariant discrete transitions and linear, discrete transitions. Once the time-variable is removed, there is no need for a distinction
  • Introduce a semilinear discrete transition. This will be the point of interaction for ODE solver observation models, and EK1 and EK0 can act on this one accordingly
@pnkraemer pnkraemer added refactoring Refactoring of existing functionality filtsmooth Issues related to filtering and smoothing labels Feb 9, 2022
@pnkraemer pnkraemer self-assigned this Feb 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
filtsmooth Issues related to filtering and smoothing refactoring Refactoring of existing functionality
Projects
None yet
Development

No branches or pull requests

1 participant