**smoothing**¶

This module implements off-line smoothing algorithms as methods of class particles.smoothing.ParticleHistory. Off-line smoothing amounts to approximate the distribution of the complete trajectory \(X_{0:T}\), given data \(y_{0:T}\), at some fixed time horizon T. The corresponding algorithms require:

1. to run a particle filter forward in time (from time 0 to time T), and store its complete

history(at each time t, the particles, their weights, and their ancestor indices);2. to do some computations on that history, e.g. reconstructing trajectories backward.

In practice, to do Step 1, we initialize a SMC algorithm with option
`store_history`

set to `True`

(see core module). Upon completion,
the SMC object has a `hist`

attribute, which is an instance of
particles.smoothing.ParticleHistory; then, to do Step 2, we use the appropriate method.
Here is a quick example:

```
# forward pass
pf = particles.SMC(fk=my_fk_model, N=100, store_history=True)
# generate 20 smoothing trajectories
trajectories = pf.backward_sampling(20)
```

For more details, see the documentation of particles.smoothing.ParticleHistory (and Chapter 12 of the book).

Warning

the complete history of a particle filter may take a lot of memory.

## Module summary¶

`ParticleHistory` (model, N) |
Particle history. |

`smoothing_worker` ([method, N, seed, fk, …]) |
Generic worker for off-line smoothing algorithms. |