Tpsi 3160 sryu#11
Closed
shokoryu wants to merge 307 commits into
Closed
Conversation
Added functions to create a kinematic Kalman filter and a kinematic state transition matrix.
The code for sizing and assignement of H was incorrect for the kinematic filter
in two places. Now we compute it once and store it to gain a bit of speed.
things like k.R = 1, and the result would be k.R == np.array([[1],[1]]) and such. It makes for tricky code, and is slower as well.
the entire book, but there admiteddly isn't much there. I've added a link to my book in most of the classes to help point people in the right direction.
The functions update and predict allow you to use floats instead of matrices to implement the univariate case. However, there were forms of dot(a,b).dot(c) in the code, which raise exceptions if all the variables are floats. Changed to the nested form dot(dot(a,b),c)
changed relevant int constants to floats. Along the way added spaces after commas where needed, and converted the remaining .dot calls to the nested dot(dot form.
I was importing Kalmanfilter, but it needed to be relative.
I was setting them to zero; if you call predit() or update() you get an exception because the rest of the variables are properly initialized.
It was creating H with the wrong dimension and value. Updated the tests to test for this.
I was not creating all of the matrices with the correct size. That fix is already checked in, but this tests for it.
I was computing F incorrectly if order_by_dim=False
I reshape z based on the KF's dimensions, but I had a few bugs since I assumed that x must be shaped (N,1), but a lot of my code uses the 1D form. I think I should remove the 1D form as it is pretty confusing and incompatible with, for exmaple, the UKF module.
For some reason I was trying to do an absolute import for kalman.
It's time to switch to Python 3.5. Deal with it!
add missing letters
Added function to compute log-likelihood without using the KalmanFilter class.
Measurement matrix dimensions in Kalman filter class doc block is misleading and should be changed.
Fix a bug where 2nd order GH ignores k
Fix doc block for Kalman filter measurement matrix
Calling log_likelihood(z) really messes up the IMM code, since it shouldn't really need to remember z. Also, it forces the innovation to be recomputed. Therefore, I added an attribute as to whether we should automatically compute the log-likelihood during updates.
There were several minor issues that I cleaned up.
kinematic_kf creates an object of type KalmanFilter. However, you may want to use a different class, so now you can optionally pass in a pre-created filter.
If you pass a list or tuple to pretty_str it will now print out and indexed list of the content of the list, one per line
Copied code for computing the logpdf from scikit-learn to make the tests more robust by comparing with a different compuational technique
was using np.size to get length of the z list, but now that we allow None in the list that caused a warning that the array was ragged. Switched to using len()
It creates deprecation warning if you dont' pass in 1D arrays. Filterpy's mahalanobis function is more forgiving, so switched to using it instead.
Added two functions; one to compare the states of two vectors, and one to copy the states of one to another. Mostly useful for writing unit tests.
Update README.rst
Added method to automatically generate a __repr__ string from a filtering class. Ran black to auto format everything.
If a variable has the format y=[[2.]] for each update, then the saver contains [[[2.]], [[3.]], ...] and after flattening it was a 2D colmn array. This is a bug, and I changed it to flatten that 2D column array to a 1D array.
ef27681 to
99c8d44
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Jira
What this PR includes