Particle Filter with Resampling
- Inputs:
- Observations \(\{y_1, y_2, \dots, y_T\}\)
- Number of particles \(N\)
- Transition model \(p(x_t \mid x_{t-1})\)
- Emission model \(p(y_t \mid x_t)\)
- Initial distribution \(p(x_1)\)
- Initialization: For \(i = 1\) to \(N\)
- Set \(x_0^{(i)} \leftarrow x_0\)
- Set weight \(w_1^{(i)} \leftarrow 1/N\)
- For \(t = 1\) to \(T\)
- For \(i = 1\) to \(N\)
- Sample \(x_t^{(i)} \sim p(x_t \mid x_{t-1}^{(i)})\)
- Compute weight \(w_t^{(i)} \leftarrow w_{t-1}^{(i)} \cdot p(y_t \mid x_t^{(i)})\)
- Normalize weights \(w_t^{(i)} \leftarrow \frac{w_t^{(i)}}{\sum_{j=1}^N w_t^{(j)}}\)
- Return: Particles \(\{x_t^{(i)}\}\) and weights \(w_t^{(i)}\) for all \(t\)