# 漫談 HMM之三：Kalman/Particle Filtering

## 漫談 HMM之三：Kalman/Particle Filtering

α(zt 1)=∫ztα(zt)p(zt 1|zt)dztp(xt 1|zt 1) \alpha(z_{t 1}) = \int_{z_t}\alpha(z_t)p(z_{t 1}|z_t)\;dz_t\;p(x_{t 1}|z_{t 1})

β(zt)=∫zt 1p(xt 1|zt 1)β(zt 1)p(zt 1|zt)dzt 1 \beta(z_t) = \int_{z_{t 1}} p(x_{t 1}|z_{t 1})\beta(z_{t 1})p(z_{t 1}|z_t)\;dz_{t 1}

p(xt|zt)=N(zt,Σ) p(x_t|z_t) = \mathcal{N}(z_t,\Sigma)

p(zt 1|zt)=N(Azt,Σ′) p(z_{t 1}|z_t) = \mathcal{N}(Az_t,\Sigma’)

γ(zt)≜p(zt|xT0)=α(zt)β(zt)p(xT0) \gamma(z_t) \triangleq p(z_t|x_0^T) = \frac{\alpha(z_t)\beta(z_t)}{p(x_0^T)}

P^x(⋅)=1N∑Ni=11xi(⋅) \hat{P}_x(\cdot) = \frac{1}{N}\sum_{i=1}^N \mathbf{1}_{x_i}(\cdot)

Ex[f(x)]≈1N∑Ni=1f(xi) \mathbb{E}_{x}[f(x)] \approx \frac{1}{N}\sum_{i=1}^N f(x_i)

p(x)=p∗(x)Zp p(x) = \frac{p^*(x)}{Z_p}

wi=p∗(xi)q(xi) w_i = \frac{p^*(x_i)}{q(x_i)}

1N∑Ni=1wif(xi)1N∑Ni=1wi→Ep[f(x)]a.s.,as N→∞ \frac{\frac{1}{N}\sum_{i=1}^N w_if(x_i)}{\frac{1}{N}\sum_{i=1}^N w_i} \rightarrow \mathbb{E}_p[f(x)]\;a.s., \quad \text{as } N\rightarrow\infty

E[w~t 1i]E[w~t 1if(zt 1i)]=∫w~t 1iq(zti)dzti=∫p(zti|xt0)dzti=1=E[E[w~t 1if(zt 1i)|zti]]=∫∫w~t 1if(zt 1i)p(zt 1i|zti)q(zti)dzt 1idzti=∫f(zt 1i)∫p(zti|xt0)p(zt 1i|zti)dztidzt 1i=∫f(zt 1i)p(zt 1i|xt0)dzt 1i=E[f(zt 1i)|xt0] \begin{aligned} \mathbb{E}[\tilde{w}^{t 1}_i] &= \int \tilde{w}^{t 1}_i q(z^t_i) \;d z^t_i \\ &= \int p(z_i^t|x_0^t)\;dz_i^t \\ &= 1 \\ \mathbb{E}[\tilde{w}_i^{t 1}f(z_i^{t 1})] &= \mathbb{E}\left[\mathbb{E}[\tilde{w}_i^{t 1}f(z_i^{t 1})|z^t_i]\right] \\ &= \int\int \tilde{w}_i^{t 1}f(z_i^{t 1}) p(z^{t 1}_i|z^t_i)q(z^t_i)\;dz^{t 1}_idz^t_i \\ &= \int f(z^{t 1}_i) {\color{red}{\int p(z^t_i|x_0^t)p(z^{t 1}_i|z_i^t)\;dz^t_i}}\;dz^{t 1}_i \\ &= \int f(z_i^{t 1}) {\color{red}{p(z_i^{t 1}|x_0^t)}}\;dz_i^{t 1} \\ &= \mathbb{E}[f(z^{t 1}_i)|x_0^t] \end{aligned}

wt 1i=w~t 1ip(xi 1|zt 1i)=wtip(xi 1|zt 1i) w^{t 1}_i = \tilde{w}^{t 1}_i p(x_{i 1}|z^{t 1}_i) = w^t_i p(x_{i 1}|z^{t 1}_i)