Question regarding future_cutoff definition and edge handling in run_mmp_factorized #329
-
|
Hi, thanks for the great library and the clear implementation of marginal message passing. I have a question regarding the definition of future_cutoff and the handling of future messages at the end of the inference window in pymdp/algos/mmp.py. In run_mmp_factorized, we have the following logic: With future_cutoff = past_len + future_len - 2 and the condition if t >= future_cutoff:, the future message appears to be dropped for the last two timesteps:
From a technical perspective, the future message could still be computed at t = infer_len - 2 (since qs_seq[t+1] exists), and strictly speaking, qs_seq[t+1] is only out of range at t = infer_len - 1. I have a few questions regarding this:
I would appreciate any clarification on the intended edge-handling logic and whether the current choice is critical for numerical stability. Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Hi @ikedaaaaa , sorry for the late reply and thanks for your question! You’re reading this correctly: from pure indexing, one more The Line 59 in 23c206f coeff switch at Line 114 in 23c206f qs_seq[t+1] exists.
In the MATLAB cross-validation generation-code, backward messages are only applied under R=t at line 15, which creates the same boundary behavior.
Setting |
Beta Was this translation helpful? Give feedback.
Hi @ikedaaaaa , sorry for the late reply and thanks for your question!
You’re reading this correctly: from pure indexing, one more
t+1message is possible.But in
pymdp, this cutoff is intentional to be aligned with the original SPM/DEM implementation, not just an array-bounds guard.The
future_cutofflogic inpymdp/pymdp/algos/mmp.py
Line 59 in 23c206f
coeffswitch atpymdp/pymdp/algos/mmp.py
Line 114 in 23c206f
qs_seq[t+1]exists.In the MATLAB cross-va…