add determinsitic sites for extracting filtering from predictives.#72
Conversation
…y want to be careful about memory during MCMC though...
DanWaxman
left a comment
There was a problem hiding this comment.
As you mention, saving these things can be a big issue in some cases (long MCMC and/or really large state-space). Before, we had commented-out options to save/not save -- I think we should reinstate that (maybe also option to save only diagonal covar, etc.).
| "tnj,tnk,tn->tjk", particles, particles, jnp.exp(log_weights) | ||
| ) | ||
| filtered_covariances = second_mom - jnp.einsum( | ||
| "tj,tk->tjk", filtered_means, filtered_means |
There was a problem hiding this comment.
... for when #60 lands? (it will eventually...)
There was a problem hiding this comment.
also not sure how to know where to put ... in anticipation of batching
|
Two remaining things: documentation of what's happening, and also some tests. |
| second_mom = jnp.einsum( | ||
| "tnj,tnk,tn->tjk", particles, particles, jnp.exp(log_weights) | ||
| ) | ||
| filtered_covariances = second_mom - jnp.einsum( | ||
| "tj,tk->tjk", filtered_means, filtered_means | ||
| ) |
There was a problem hiding this comment.
I think this should work
| second_mom = jnp.einsum( | |
| "tnj,tnk,tn->tjk", particles, particles, jnp.exp(log_weights) | |
| ) | |
| filtered_covariances = second_mom - jnp.einsum( | |
| "tj,tk->tjk", filtered_means, filtered_means | |
| ) | |
| second_mom = jnp.einsum( | |
| "...tnj,...tnk,...tn->...tjk", particles, particles, jnp.exp(log_weights) | |
| ) | |
| filtered_covariances = second_mom - jnp.einsum( | |
| "...tj,...tk->...tjk", filtered_means, filtered_means | |
| ) |
There was a problem hiding this comment.
perfect, done, thanks
mattlevine22
left a comment
There was a problem hiding this comment.
should be ready
| add_mean = record_kwargs.get( | ||
| "record_filtered_states_mean", False | ||
| ) and _should_add_site(states.mean.shape, max_elems) | ||
| add_chol_cov = record_kwargs.get( | ||
| "record_filtered_states_chol_cov", False | ||
| ) and _should_add_site(states.chol_cov.shape, max_elems) | ||
| add_filtered_states_cov = record_kwargs.get( | ||
| "record_filtered_states_cov", False | ||
| ) and _should_add_site((T1, state_dim, state_dim), max_elems) | ||
| add_filtered_states_cov_diag = record_kwargs.get( | ||
| "record_filtered_states_cov_diag", False | ||
| ) and _should_add_site((T1, state_dim), max_elems) |
There was a problem hiding this comment.
Why and instead of or? Seems weird I can't override our (helpful, yet arbitrary) _should_add_site suggestion.
There was a problem hiding this comment.
I see, yeah. I guess then I should default these things to True and switch to or?
|
I don’t think defaulting to true does anything, right? Still can’t override
a _should_add = False. I actually think the nicest solution is to set
_should_add to be the default, then no need for conjunction.
…On Fri, Feb 6, 2026 at 8:50 PM Matt Levine ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In dynestyx/inference/cuthbert/discrete_time_filters.py
<#72 (comment)>
:
> + add_mean = record_kwargs.get(
+ "record_filtered_states_mean", False
+ ) and _should_add_site(states.mean.shape, max_elems)
+ add_chol_cov = record_kwargs.get(
+ "record_filtered_states_chol_cov", False
+ ) and _should_add_site(states.chol_cov.shape, max_elems)
+ add_filtered_states_cov = record_kwargs.get(
+ "record_filtered_states_cov", False
+ ) and _should_add_site((T1, state_dim, state_dim), max_elems)
+ add_filtered_states_cov_diag = record_kwargs.get(
+ "record_filtered_states_cov_diag", False
+ ) and _should_add_site((T1, state_dim), max_elems)
I see, yeah. I guess then I should default these things to True and switch
to or?
—
Reply to this email directly, view it on GitHub
<#72 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC2DPONLRJNNE2S6QDMRQRD4KVAETAVCNFSM6AAAAACUFBT4ACVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTONRVHA4DANJTGM>
.
You are receiving this because your review was requested.Message ID:
***@***.***>
|
|
Yeah I realized that after I merged the stuff, sorry. Fixing it now. |
|
Addressing in #81 |
{name}_filtered_states_mean,{name}_filtered_states_cov, and{name}_marginal_loglik