Steady state kalman filtering#236
Conversation
|
The computational improvements exist by are not as good as I expected. I am wondering if perhaps I missed some simple improvement, or maybe it's a feature of testing with a very high dim state which triggers an expensive QR decomposition in the prediction anyway. Not sure, I would appreciate a second look. |
| get_init_params: GetInitParams, | ||
| get_dynamics_params: GetDynamicsParams, | ||
| get_observation_params: GetObservationParams, | ||
| steady_state_params: SteadyStateFilterParams | None = None, |
There was a problem hiding this comment.
Instead of the extra arg could we have get_observation_params possibly return SteadyStateFilterParams if using steady state?
Seems to me that this PR reduces the number of |
Sahel13
left a comment
There was a problem hiding this comment.
This doesn't handle missing observation dimensions correctly. The following test fails when (and only when) y has a nan in it:
@pytest.mark.parametrize("seed", [0, 42, 99])
def test_update_steady_state_matches_qr_path_with_missing_observations(seed):
"""Steady-state update must preserve the standard NaN-observation behavior."""
nx, ny = 4, 3
F, _, chol_Q, H, d, chol_R, *_ = _make_lgssm(seed, nx, ny)
ss = compute_steady_state_filter_params(
jnp.array(F),
jnp.array(chol_Q),
jnp.array(H),
jnp.array(chol_R),
)
rng = np.random.default_rng(seed + 10)
m = jnp.array(rng.standard_normal(nx))
y = jnp.array(rng.standard_normal(ny)).at[1].set(jnp.nan)
(m_qr, chol_P_qr), ell_qr = update(
m,
jnp.array(chol_Q),
jnp.array(H),
jnp.array(d),
jnp.array(chol_R),
y,
)
(m_ss, chol_P_ss), ell_ss = update(
m,
jnp.array(chol_Q),
jnp.array(H),
jnp.array(d),
jnp.array(chol_R),
y,
steady_state_params=ss,
)
chex.assert_trees_all_close(m_ss, m_qr, atol=1e-10)
chex.assert_trees_all_close(
chol_P_ss @ chol_P_ss.T,
chol_P_qr @ chol_P_qr.T,
atol=1e-10,
)
chex.assert_trees_all_close(ell_ss, ell_qr, atol=1e-10)| :func:`update` skips the expensive per-step QR decomposition and reuses the | ||
| constant ``A``, ``U``, and ``Z`` blocks. | ||
|
|
||
| Fields: |
There was a problem hiding this comment.
| Fields: | |
| Attributes: |
| F: Array, | ||
| chol_Q: Array, | ||
| H: Array, | ||
| chol_R: Array, |
There was a problem hiding this comment.
these can have type ArrayLike
No description provided.