Conversation
Co-authored-by: Sahel Iqbal <sahel13miqbal@proton.me>
|
Do we want to support |
Yes I think we do as this is useful for smoothing and potentially other things later (like predict). It's a bit tricky as I think for filtering we want it to be strictly 1-dimensional but more generally it can be 0-dim |
Then I think the easiest fix is to always have a factorial dimension, even if |
|
So Think about whether e.g. |
Co-authored-by: Sahel Iqbal <sahel13miqbal@proton.me>
Co-authored-by: Sahel Iqbal <sahel13miqbal@proton.me>
Co-authored-by: Sahel Iqbal <sahel13miqbal@proton.me>
|
@Sahel13 I've updated the docstrings with the above comments. I think |
Is there something wrong with this test then: def test_extract_and_join_preserves_single_factor_covariance_for_scalar_index():
model_params = generate_factorial_kalman_model(
seed=1,
x_dim=2,
y_dim=1,
num_factors=3,
num_factors_local=1,
num_time_steps=1,
)
filter_obj, _, model_inputs = build_pairwise_factorial_filter(model_params)
factorializer = factorial.gaussian.build_factorializer(
get_factorial_indices=lambda _: 1
)
init_state = filter_obj.init_prepare(model_inputs[0])
joined_state = factorializer.extract_and_join(init_state, model_inputs[1])
assert joined_state.chol_cov.shape == (2, 2) |
Kinda, your |
|
I'm a bit confused now, so we don't actually support If this is intended behavior, I'm happy to merge this. |
|
Scalar I agree it's a bit confusing, not sure how we can document better |
My first attempt at a factorial API. I appreciate it's quite a lot of code added (and this is just to support Gaussian methods). Happy to break it up into multiple PRs if we think that's easier to grasp and there's a logical way to do so.
In terms of modifications to the existing
cuthbertcode I think they are minimal. I just had to change theinit_preparein Kalman so that it doesn't actually touch the observation parameters if the observationyis all nans. This is to avoid mismatching dimensions because in this factorial API the initial step is very different (acts globally across factors) to the subsequent steps (acts locally only on selected factors). (I think we'll also have to change this for the other methods too)If anything is unclear please shout and I can document better!