1 前言
- 直方图滤波适用于非线性滤波,是非参数滤波的一种
- 直方图滤波是离散贝叶斯滤波在连续状态下的实现
- 离散贝叶斯滤波:离散状态
- 直方图滤波:连续状态
- 直方图滤波的中心思想:将连续状态分段分解,在对每段做近似,再用离散贝叶斯滤波
- 直方图滤波 = 离散分解 + 离散贝叶斯滤波
- 离散分解有很大学问,不同的分段方法对滤波效果影响很大
- 细分:精度高,计算量大
- 粗分:精度低,计算量小
- 理想的离散分解:非线性弱则粗分,非线性强则细分
2 离散贝叶斯滤波算法
- 离散贝叶斯滤波算法
- 应用于有限状态的情景
- 把贝叶斯滤波的积分改成求和就是离散贝叶斯算法了
3 直方图滤波
- 直方图滤波 = 离散分解 + 离散贝叶斯滤波
3.1 分解技术
- 将连续状态 X t X_t Xt进行分解:
d o m ( X t ) = x 1 , t ∪ x 2 , t ∪ ⋯ x K , t x i , t ∩ x k , t = ∅ ⋃ k x k , t = d o m ( X t ) dom(X_t) = x_{1,t} \cup x_{2,t} \cup \cdots x_{K,t}\\ x_{i,t} \cap x_{k,t} = \varnothing \\ \bigcup_k x_{k,t} = dom(X_t) dom(Xt)=x1,t∪x2,t∪⋯xK,txi,t∩xk,t=∅k⋃xk,t=dom(Xt) - 对状态分解主要有两种思想:静态,动态
- 静态:固定粗细的分解方法,不随变换函数的非线性程度所改变
- 动态:分的粗细程度自适应变换函数
- 动态分解要优于静态分解,动态分解的方法很多,这里不做介绍,给大家看一下动态与静态的对比:
- 右下图是原始状态, x x x服从正态分布的连续状态,对它进行离散分解
- 右上图是非线性变换函数 y = g ( x ) y = g(x) y=g(x)
- 左上图是静态分解,分解间隔是定值,近似效果较差
- 中上图是动态分解,该分解的粗细程度与状态转移函数 y = g ( x ) y = g(x) y=g(x)的非线性程度有关,近似效果较好
3.2 直方图滤波介绍
- 上述介绍完对状态进行分解的方法,这里介绍分解后的计算过程
- 我们分解了很多区间,那么每一段的概率为 p k , t p_{k,t} pk,t,那么该区间概率密度:
p ( x t ) = p k , t ∣ x k , t ∣ p(x_t) = \frac{p_{k,t}}{|x_{k,t}|} p(xt)=∣xk,t∣pk,t - 再在每一段区内选一个代表点 x ^ k , t \hat{x}_{k,t} x^k,t:
x ^ k , t = ∣ x k , t ∣ − 1 ∫ x k , t x t d x t \hat{x}_{k,t} = |x_{k,t}|^{-1} \int_{x_{k,t}} x_t d x_t x^k,t=∣xk,t∣−1∫xk,txtdxt - 有了代表点就可以近似测量和状态转移概率,具体为什么这样近似看下面重要公式推导部分
p ( z t ∣ x k , t ) ≈ p ( z t ∣ x ^ k , t ) p ( x k , t ∣ u t , x i , t − 1 ) ≈ η ∣ x k , t ∣ p ( x ^ k , t ∣ u t , x ^ i , t − 1 ) p(z_t | x_{k,t}) \approx p(z_t | \hat{x}_{k,t}) \\ p(x_{k,t} | u_t, x_{i,t-1}) \approx \eta |x_{k,t}| p(\hat{x}_{k,t} | u_t, \hat{x}_{i,t-1}) p(zt∣xk,t)≈p(zt∣x^k,t)p(xk,t∣ut,xi,t−1)≈η∣xk,t∣p(x^k,t∣ut,x^i,t−1) - 所以离散贝叶斯滤波中两个公式可以表示为:
l i n e 3 : p ˉ k , t = ∑ i p ( X t = x k ∣ u t , X t − 1 = x i ) p i , t − 1 = ∑ i η ∣ x k , t ∣ p ( X t = x ^ k , t ∣ u t , X t − 1 = x ^ i , t − 1 ) p i , t − 1 l i n e 4 : p k , t = η p ( z t ∣ X t = x k ) p ˉ k , t = η p ( z t ∣ X t = x ^ k , t ) p ˉ k , t \begin{aligned} line 3: \bar{p}_{k,t} &= \sum_i p(X_t=x_k| u_t, X_{t-1} = x_i)p_{i,t-1}\\ &= \sum_i \eta |x_{k,t}| p(X_t=\hat{x}_{k,t} | u_t, X_{t-1} = \hat{x}_{i,t-1}) p_{i,t-1}\\ line 4: p_{k,t} &= \eta p(z_t | X_t = x_k) \bar{p}_{k,t}\\ &= \eta p(z_t | X_t = \hat{x}_{k,t}) \bar{p}_{k,t}\\ \end{aligned} line3:pˉk,tline4:pk,t=i∑p(Xt=xk∣ut,Xt−1=xi)pi,t−1=i∑η∣xk,t∣p(Xt=x^k,t∣ut,Xt−1=x^i,t−1)pi,t−1=ηp(zt∣Xt=xk)pˉk,t=ηp(zt∣Xt=x^k,t)pˉk,t
3.3 重要公式推导
- 测量概率近似:
p ( z t ∣ x k , t ) = p ( z t , x k , t ) p ( x k , t ) = ∫ x k , t p ( z t , x t ) d x t ∫ x k , t p ( x t ) d x t = ∫ x k , t p ( z t ∣ x t ) p ( x t ) d x t ∫ x k , t p ( x t ) d x t = ∫ x k , t p ( z t ∣ x t ) p k , t ∣ x k , t ∣ d x t ∫ x k , t p k , t ∣ x k , t ∣ d x t = p k , t ∣ x k , t ∣ p k , t ∣ x k , t ∣ ∫ x k , t p ( z t ∣ x t ) d x t ∫ x k , t 1 d x t = ∣ x k , t ∣ − 1 ∫ x k , t p ( z t ∣ x t ) d x t ≈ ∣ x k , t ∣ − 1 ∫ x k , t p ( z t ∣ x ^ k , t ) d x t = ∣ x k , t ∣ − 1 p ( z t ∣ x ^ k , t ) ∫ x k , t 1 d x t = ∣ x k , t ∣ − 1 p ( z t ∣ x ^ k , t ) ∣ x k , t ∣ = p ( z t ∣ x ^ k , t ) ↓ p ( z t ∣ x k , t ) ≈ p ( z t ∣ x ^ k , t ) \begin{aligned} p(z_t|x_{k,t}) & = \frac{p(z_t, x_{k,t})}{p(x_{k,t})}\\ &= \frac{\int_{x_{k,t}} p(z_t, x_t) d x_t}{\int_{x_{k,t}} p( x_t) d x_t}\\ &= \frac{\int_{x_{k,t}} p(z_t| x_t) p(x_t) d x_t}{\int_{x_{k,t}} p( x_t) d x_t}\\ &= \frac{\int_{x_{k,t}} p(z_t| x_t) \frac{p_{k,t}}{|x_{k,t}|} d x_t}{\int_{x_{k,t}} \frac{p_{k,t}}{|x_{k,t}|} d x_t}\\ &= \frac{\frac{p_{k,t}}{|x_{k,t}|}}{\frac{p_{k,t}}{|x_{k,t}|}} \frac{\int_{x_{k,t}} p(z_t| x_t) d x_t}{\int_{x_{k,t}} 1 d x_t}\\ &= |x_{k,t}|^{-1} \int_{x_{k,t}} p(z_t| x_t) d x_t\\ &\approx |x_{k,t}|^{-1} \int_{x_{k,t}} p(z_t| \hat{x}_{k,t}) d x_t\\ &= |x_{k,t}|^{-1} p(z_t| \hat{x}_{k,t}) \int_{x_{k,t}} 1 d x_t\\ &= |x_{k,t}|^{-1} p(z_t| \hat{x}_{k,t}) |x_{k,t}|\\ &= p(z_t| \hat{x}_{k,t}) \\ \end{aligned}\\ \downarrow\\ p(z_t | x_{k,t}) \approx p(z_t | \hat{x}_{k,t}) p(zt∣xk,t)=p(xk,t)p(zt,xk,t)=∫xk,tp(xt)dxt∫xk,tp(zt,xt)dxt=∫xk,tp(xt)dxt</