-
Notifications
You must be signed in to change notification settings - Fork 81
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
Added EKF sampler #313
Added EKF sampler #313
Conversation
Thanks @calebweinreb! This looks good to me. Is there a way to test this function? I guess we could check that the sample mean matches the EKF smoother mean? |
Here's two tests possible tests: 1. Match to LGSSMThe output of
2. Match to smootherThe site-wise mean and variance of the sampled states should match marginal mean and covariance from the smoother. Here's an example using the pendulum example from the docs.
The error seems reasonable given the sample size:
yields
|
These are both great tests. Please add them to https://github.com/probml/dynamax/blob/main/dynamax/nonlinear_gaussian_ssm/inference_ekf_test.py. |
I added testing functions that are similar to the ones proposed above but use the examples generated by
In the process of writing these tests, I found that
|
This PR adds
extended_kalman_posterior_sample
, which has the same signature aslgssm_posterior_sample
. It behaves as expected for the pendulum example in the docs:Increasing the process and observation noise 20-fold:
This PR also adds the following tests:
In the process of writing these tests, I found that
lgssm_filter
andextended_kalman_filter
returned asymmetric covariance matrices for the default examples indynamax.nonlinear_gaussian_ssm.inference_test
(see issue #317). As a result, the outputs oflgssm_posterior_sample
andextended_kalman_posterior_sample
were all NaN and could not be used for testing. This asymmetry issue is addressed in two separate PRs (#318 forlgssm_filter
and #319 forextended_kalman_filter
). Both of those PRs need to be merged before this one or the tests won't work. So the overall merge order would be: