Turing.jl
Turing.jl copied to clipboard
[Traces]: add a member field to `Trace` to mark reference particle
The current resample!
function requires an additional parameter to distinguish between normal particles and reference particle in conditional SMC. Perhaps a cleaner solution is to add a member field (e.g. is_ref
) to the Trace
type?
That's seems like a good idea indeed.
Isn't the reference particle always the last particle in the container, i.e., pc.vals[end]
in a container pc
? So I'm thinking maybe it would be more natural to have two implementations resample!
and resample_with_reference!
(or use only resample!
and dispatch on a method type) instead of adding a field to every trace. In that way, i.e., without an additional field is_ref
, it is also easier to guarantee that there exists only one reference particle in a container.