MerweScaledSigmaPoints weights do not sum to 1, documentation says it should
See original GitHub issueFor example:
import numpy as np
from filterpy.kalman import MerweScaledSigmaPoints as SigmaPoints
sigma_points = SigmaPoints(n=9, alpha=0.001, beta=2, kappa=-6)
Wm, Wc = sigma_points.weights()
print np.sum(Wm)
print np.sum(Wc)
Which returns
1.0000000005238689
3.9999990007490851
While Wm is small enough to be rounding error, Wc seems to go against notes in the documentation. Now, I’m not saying MerweScaledSigmaPoints is set wrong – as far as I can tell all the equations are right. However, the book and documentation both say that Wc “must sum to 1”.
So what’s the deal?
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Source code for filterpy.kalman.sigma_points
[docs]class MerweScaledSigmaPoints(object): """ Generates sigma points and weights according to Van der Merwe's 2004 dissertation[1] for the ...
Read more >10-Unscented-Kalman-Filter.ipynb
We must conclude that one sample will not work. ... The first two equations are the constraint that the weights must sum to...
Read more >10-Unscented-Kalman-Filter.ipynb
We must conclude that a one point sample will not work. ... For this to work for identity we will want the sums...
Read more >Scaling factor and weights in Unscented Transform (UKF)
I observe the same thing about the covariance weight. The sum of mean weight is 1 while the sum of covariance weight is...
Read more >Kalman and Bayesian Filters in Python
I will teach you enough to get started; refer to NumPy's documentation if you ... 61 This is not a probability distribution because...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have noticed also noticed that my 0’th weight is negative for all reasonable parameterizations and that I occasionally get non-positive semidefinite matracies.
I found additional discussion at Math Stack Exchange on these negative values.
In that same journal article, I found the warning
It looks like the Scaled Sigma Point selection used in this library is partially different. In the Scaled Sigma Point selection section in the Bayesian filtering book it says
While the Van der Merwe selection method is supposed to be based on Julier’s Scaled Unscented Transform, the weighting methods seems significantly. Particularly, in “The Scaled Unscented Transform” all weights are chosen to force the sum of them to be equal to 1. @rlabbe is there any chance you could help me understand the differences?
For now I have switched to using
JulierSigmaPoints
, but I would prefer a scaled sigma point selection method.I confirm that the Wm values sum to 1, and the Wc values sum to 4. The covariance matrix for the output ‘Y’ doesn’t look right in my own testing. My covariance matrix… ie. Py has unusually large positive values for the variance (diagonal) terms. Just doesn’t look right. This is likely due to the weights not being what we need.
Peter-Moran said this : “Then wouldn’t the covariance grow as a function of the sum of your sigma points? If that is true, that would mean that your sigma point definition would seriously impact your system covariance, right?”
That’s exactly what I’m seeing right now. I computed the Wc weight values…they do sum up to 4… and when I use those weights for getting the Py (ie. output covariance matrix) matrix, the elements of Py appear too large. Something isn’t right with the way that these weights are selected, or chosen. No problem with Wm weights though, as they definitely sum to 1. The problem is with the Wc weight values.