Skip to content

Commit 2d9563d

Browse files
Fix backward weights:
1 parent 4ebf16f commit 2d9563d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/algorithms/ffbs.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,12 @@ function smooth(
4343
idx_ref = rand(rng, Categorical(weights(particles.filtered)), M)
4444
trajectories = Array{eltype(model.dyn)}(undef, n_timestep, M)
4545

46-
forward_state = particles.filtered[idx_ref]
47-
trajectories[end, :] = forward_state
46+
trajectories[end, :] = particles.filtered[idx_ref]
4847
for step in (n_timestep - 1):-1:1
4948
for j in 1:M
5049
transitions = map(
5150
x ->
52-
SSMProblems.logdensity(model.dyn, step, forward_state[j], x; kwargs...),
51+
SSMProblems.logdensity(model.dyn, step, x, trajectories[step+1]; kwargs...),
5352
recorder.particles[step, :],
5453
)
5554
backward_weights = recorder.log_weights[step, :] + transitions

0 commit comments

Comments
 (0)