Closed whentheworldfallsapart closed 3 years ago
I can't diagnose this without more data/code. What is in master should be correct.
I didn't realize the last release was so old. I suppose it is possible master has a bug, but it has gone unreported because people are running from the release.
However, for var(x) to go so small (-1e-10) after only one update makes me question the implementation. That much certainty (ignoring it is negative) after one update is not normal.
Thank you Roger, that answers my questions. I will use the master since it has the fix. And that insight on the var(x), lead me to realize my measurement uncertainty matrix R was too small, with that context it make sense that var(x) would go small. (Init R with np.zeros and dont fill it correctly that is what happens, corrected R and everything looks good. Strangely enough the release 1.4.5 didnt care with the sigma points not getting updated after the prior was computed.)
I am using UKF with a CV model. I initialize P and after the first call to predict, then update, P becomes non positive definite. So on the next measurement when predict I get the above error.
This only happens in master branch not in release 1.4.5. I traced down the issue to this commit: https://github.com/rlabbe/filterpy/commit/94852b4213875f380be1d7cb4d83283af9a4e23a
This is only an issue with the default sqrt function (scipy.linalg.cholesky), if I switch to scipy.linalg.sqrtm then the issues doesnt occur. So I can work around it by either switching the sqrt function or by using the release not master (the only reason i switch to the master is I was playing with IMM, which is outside of this issue as this happens with a single UKF). However, is the implementation in of the UKF in release 1.4.5 valid if the following is missing in the predict function
Should I be using the master branch to have this correction? (I am assuming it is a correction, I dont have the references to easily check that). This may be a case where it is only my data, but the issue happens after only one measurement update so i dont think it is because the filter is diverging. I thought i would reach out for help, any suggestions are welcome.