Skip to content
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

FFBS performance improvements #76

Open
brandonwillard opened this issue Mar 7, 2021 · 1 comment · Fixed by #81
Open

FFBS performance improvements #76

brandonwillard opened this issue Mar 7, 2021 · 1 comment · Fixed by #81
Labels
enhancement New feature or request

Comments

@brandonwillard
Copy link
Contributor

There are a few straightforward things we can do to improve sampling performance:

  • Re-use allocated log-likelihood arrays
    • These arrays can be fairly large (i.e. length of the series by the number of states), and they are re-created/allocated during each sample step. If we allocate them once in thread-local storage within the sampler object and operate on them in-place, then we can dramatically reduce the costs associated with generating new, large arrays.
  • A Cython/Numba implementation of the FFBS step.
    • This would likely be a marginal improvement in most cases, but it might be possible to entirely reformulate the approach at this level and get something more out of it (e.g. better scaling in series length, perhaps). Otherwise, one big problem with this approach: individual, in-loop calls to the log-likelihood functions probably incur too much overhead to be worthwhile from C/elsewhere.
@brandonwillard
Copy link
Contributor Author

#81 added some important improvements, including two forms of in-place updating for series-length arrays; however, there are still a couple important in-place opportunities that involved the Theano graphs (see the TODOs here).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant