You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Incorrect summary statistics in LinearGaussianConjugateSSM.fit_blocked_gibbs #416
where we defined $x^{(i)}_{zt} = [z^{(i)}_{t-1}, u^{(i)}_t, 1]^\intercal$. Using the conjugacy of the matrix normal inverse-Wishart distribution, the dynamics parameters and variances, $Q, W_{z} \sim \mathcal{MN}\mathcal{W}^{-1} (M_{z}, V_{z}, \nu_{q}, \psi_{q})$, given the states are derived from the summary statistics:
However, in the code the summary statistics are calculated based on $[z^{(i)}_{t}, u^{(i)}_t, 1]^\intercal $ instead of $x^{(i)}_{zt} = [z^{(i)}_{t-1}, u^{(i)}_t, 1]^\intercal $.
I had already corrected this mistake in PR #403. But if you want, I can make a separate PR with just this fix instead.
Hi @hylkedonker, thank you for finding this! I agree that this is a bug, and in my opinion a separate PR would be helpful to expedite getting this fixed. Let me know if you’re still interested in working on that, or I’m happy to give it a go.
Also, it looks to me like this bug extends beyond LinearGaussianConjugateSSM.fit_blocked_gibbs to a lot of continuous state inference. (I would check: linear_gaussian_ssm/inference.py, linear_gaussian_ssm/parallel_inference.py, linear_gaussian_ssm/info_inference.py, linear_gaussian_ssm/models.py, nonlinear_gaussian_ssm/inference_ekf.py, nonlinear_gaussian_ssm/inference_ukf.py, generalized_gaussian_ssm/inference.py, slds/inference.py.)
While investigating, I noticed that the input timing convention is not consistent across the LinearGaussianSSM code paths: sample uses the input associated with the transition into (z_t), while the filter/smoother, EM M-step, and Gibbs statistics currently use a different indexing convention.
Since changing only the Gibbs statistics could leave the Gibbs sampler internally inconsistent, I’m thinking of first aligning the relevant linear-Gaussian inference paths and adding a consistency regression test, rather than making an isolated one-line change.
I also noticed the overlap with PR #403. Before I start implementing, could you confirm whether this broader scope is appropriate for #416, and whether anyone is currently working on this issue?
Hi @PeerAhammad, thank you for investigating! I’ve been working on #466, almost complete, that I believe fixes the issues you’ve found, as well as some related ones. Please let me know if I’ve missed any of your concerns!
Thanks @nkbranigan, #466 appears to cover everything I found, so I'll hold off on a separate PR. I independently reproduced the input-timing mismatch in the linear Gaussian filters, EM, and Gibbs statistics, and I have a dense joint-Gaussian reference test (filter log-likelihood and smoothed means against sample's convention), along with EM/Gibbs recovery tests for the input weights. Happy to contribute these to #466 or run them against your branch if useful.
Activity
nkbranigan commentedon Aug 26, 2026
Hi @hylkedonker, thank you for finding this! I agree that this is a bug, and in my opinion a separate PR would be helpful to expedite getting this fixed. Let me know if you’re still interested in working on that, or I’m happy to give it a go.
Also, it looks to me like this bug extends beyond
LinearGaussianConjugateSSM.fit_blocked_gibbsto a lot of continuous state inference. (I would check:linear_gaussian_ssm/inference.py,linear_gaussian_ssm/parallel_inference.py,linear_gaussian_ssm/info_inference.py,linear_gaussian_ssm/models.py,nonlinear_gaussian_ssm/inference_ekf.py,nonlinear_gaussian_ssm/inference_ukf.py,generalized_gaussian_ssm/inference.py,slds/inference.py.)hylkedonker commentedon Aug 31, 2026
Unfortunately, I currently have little additional time on my hands to make a separate PR.
So, feel free to give it a go! ;-)
nkbranigan commentedon Sep 1, 2026
Sounds good, and will do!
PeerAhammad commentedon Oct 2, 2026
Hi, I’d like to work on this issue.
While investigating, I noticed that the input timing convention is not consistent across the
LinearGaussianSSMcode paths:sampleuses the input associated with the transition into (z_t), while the filter/smoother, EM M-step, and Gibbs statistics currently use a different indexing convention.Since changing only the Gibbs statistics could leave the Gibbs sampler internally inconsistent, I’m thinking of first aligning the relevant linear-Gaussian inference paths and adding a consistency regression test, rather than making an isolated one-line change.
I also noticed the overlap with PR #403. Before I start implementing, could you confirm whether this broader scope is appropriate for #416, and whether anyone is currently working on this issue?
Thanks!
nkbranigan commentedon Oct 3, 2026
Hi @PeerAhammad, thank you for investigating! I’ve been working on #466, almost complete, that I believe fixes the issues you’ve found, as well as some related ones. Please let me know if I’ve missed any of your concerns!
PeerAhammad commentedon Oct 3, 2026
Thanks @nkbranigan, #466 appears to cover everything I found, so I'll hold off on a separate PR. I independently reproduced the input-timing mismatch in the linear Gaussian filters, EM, and Gibbs statistics, and I have a dense joint-Gaussian reference test (filter log-likelihood and smoothed means against
sample's convention), along with EM/Gibbs recovery tests for the input weights. Happy to contribute these to #466 or run them against your branch if useful.