Open
Conversation
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.
Closes #394
Related to #332
For certain classes of models, the latent state covariance matrix estimated by the Kalman Filter converges to a fixed point, after which is is no longer necessary to compute via expensive linear algebra. This PR adds a new filter,
ConvergentFIlter, that exploits this property. To take advantage, a model must:The
ConvergentFilteruses awhilescan, so this cannot be used with jax. All timings are done with numba.These break the convergence assumptions. But nothing else is required. If these criteria are met, we get big speedups. Here is a table of models, where
nis the number of timesteps,mis the number of hidden states,pis the number of observed states, andris the number of shocks. The biggest speedups come from long time series, where there is more iterations in the compute-saving post-convergence scan. Here are some timings for the compiledlogp_dlogpfunction for models taken from the example notebooks:Special thanks to @JeanVanDyk, who derived components of the closed forms used in the handoff step between the two scans. I tried using the full analytic forms he worked out end-to-end, but it was slower than autodiff, I believe because of the number of matmuls involved. It might be faster on GPU, so I want to revist that again at some point.