dstl / Stone-Soup

A software project to provide the target tracking community with a framework for the development and testing of tracking algorithms.
https://stonesoup.rtfd.io
MIT License
406 stars 134 forks source link

transition_model lacks "matrix" attribute - jacobian? #853

Closed Orchidaceae closed 8 months ago

Orchidaceae commented 1 year ago

I encountered an issue when following the Introduction guide to Kalman filter. The transition_model referenced on Line 72 and 92 in kalman.py does not have a matrix attribute. In this case I believe that the referenced CombinedGaussianTransitionModel do have a jacobian attribute to be used instead, like this:

# line 72
return self.transition_model.jacobian(state=kwargs['prior'], **kwargs)

# line 92
return self.transition_model.jacobian(state=prior, **kwargs) @ prior.state_vector

With these changes the example runs just fine, I am however not sure if it will work for other transition models.

jswright-dstl commented 1 year ago

The Kalman filter tutorial uses the CombinedLinearGaussianTransitionModel which takes linear Gaussian transition models that all have the .matrix attribute. The CombinedGaussianTransitionModel is slightly different, the assumption is that the transition models used here are Gaussian, i.e., not linear (and no matrix attribute) and require the use of the .jacobian attribute.