-
Notifications
You must be signed in to change notification settings - Fork 85
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
Mutable/Movable parameters for multivariate normal #180
Comments
Hi, are you still considering this for MCMC? If so, I think your solution that preserves immutability would be good. I'd be open to a PR for this, please consider making this atop #209 as we plan to merge those changes and those change the multivariate API Aside as a possibility for an optimization if the math is nice: |
@FreezyLemon did some profiling demonstrating the allocation is much less time consuming than the linalg operations and shared it in #278. It does seem like struct instantiation could have been a bottleneck for MCMC iterations as it could happen up to every step. If we do anything in this space to support low-dimensional MCMC we should probably look at
I think high dimensionality should rely on a different dependency. |
Hello, I'm studying the possibility of using this crate for Markov Chain Monte Carlo (MCMC) based inference. In this use case, the log-density of a distribution is evaluated repeatedly at different parameter values. To do that currently, the crate requires re-creating the distributions at each iteration. This isn't much of a problem for scalar distributions, but for the multivariate normal, I have to re-allocate the mean vector and covariance matrix at each iteration (since distributions are immutable), which impacts performance.
Allowing the user to re-set the parameters separately would work:
But a solution that moves the parameters out of the struct would also work (therefore preserving the intended immutable API):
Are there any plans to offer something like that?
The text was updated successfully, but these errors were encountered: