看上去不错的网站:http://iacs-courses.seas.harvard.edu/courses/am207/blog/lecture-18.html

SciPy Cookbook:http://scipy-cookbook.readthedocs.io/items/KalmanFiltering.html


良心视频:卡尔曼滤波器的原理以及在matlab中的实现

讲解思路貌似是在已知迭代结果的基础上做讲解,不是很透彻。

1. 用矩阵表示

2. 本质就是:二维高斯的协方差与sampling效果

3. 不确定性在状态之间的传递

4. 矩阵表示观察数据

5. Kalman系数

6. 噪声协方差矩阵的更新

7. Matlab实现

思考: 

与数学领域 openBUGS 的估参的关系是什么?[Bayes] openBUGS: this is not the annoying bugs in programming

一个是对逐渐增多数据的实时预测;一个是对总体数据的回归拟合。

代码示例:纯python代码

# Kalman filter example demo in Python

# A Python implementation of the example given in pages 11-15 of "An
# Introduction to the Kalman Filter" by Greg Welch and Gary Bishop,
# University of North Carolina at Chapel Hill, Department of Computer
# Science, TR 95-041,
# http://www.cs.unc.edu/~welch/kalman/kalmanIntro.html # by Andrew D. Straw import numpy as np
import matplotlib.pyplot as plt plt.rcParams['figure.figsize'] = (10, 8) # intial parameters
n_iter = 50
sz = (n_iter,) # size of array
x = -0.37727 # truth value (typo in example at top of p. 13 calls this z)
z = np.random.normal(x,0.1,size=sz) # observations (normal about x, sigma=0.1)
# 已获得一组随机数 Q = 1e-5 # process variance # allocate space for arrays
xhat =np.zeros(sz) # a posteri estimate of x
P =np.zeros(sz) # a posteri error estimate
xhatminus =np.zeros(sz) # a priori estimate of x
Pminus =np.zeros(sz) # a priori error estimate
K =np.zeros(sz) # gain or blending factor R = 0.1**2 # estimate of measurement variance, change to see effect # intial guesses
xhat[0] = 0.0
P[0] = 1.0

# 开始迭代
for k in range(1, n_iter):
# time update
xhatminus[k] = xhat[k-1]
Pminus[k] = P[k-1]+Q # measurement update
K[k] = Pminus[k]/( Pminus[k]+R )
xhat[k] = xhatminus[k]+K[k]*(z[k]-xhatminus[k])
P[k] = (1-K[k])*Pminus[k] plt.figure()
plt.plot(z,'k+',label='noisy measurements')
plt.plot(xhat,'b-',label='a posteri estimate')
plt.axhline(x,color='g',label='truth value')
plt.legend()
plt.title('Estimate vs. iteration step', fontweight='bold')
plt.xlabel('Iteration')
plt.ylabel('Voltage') plt.figure()
valid_iter = range(1,n_iter) # Pminus not valid at step 0
plt.plot(valid_iter,Pminus[valid_iter],label='a priori error estimate')
plt.title('Estimated $\it{\mathbf{a \ priori}}$ error vs. iteration step', fontweight='bold')
plt.xlabel('Iteration')
plt.ylabel('$(Voltage)^2$')
plt.setp(plt.gca(),'ylim',[0,.01])
plt.show()

Result: 

Goto: [OpenCV] Samples 14: kalman filter

其实,真正的Kalman Filter用得是如下理论,上述例子只是教小学生的入门读物。

Goto: https://www.youtube.com/watch?v=UVNeulkWWUM by XU Yida

关键需要理解: http://www.cnblogs.com/rubbninja/p/6220284.html

【重点】证明过程的理解关键是:

因为是线性滤波器,本身又具备一个alpha迭代的过程,那么先找出joint distribution,

然后,根据高斯的性质直接得出条件概率,即是Update Rule,这样正好对应于滤波器的alpha迭代过程的形式。

这个条件概率就是关于xt的,也就是最新的状态的概率分布,那么期望也就是miu,就是最新的xt。

大概就是这么个思路,笔记在本本上,具体请看视频。符号比较多,但大体就是如上脉络。

[Scikit-learn] Dynamic Bayesian Network - Kalman Filter的更多相关文章

  1. [Scikit-learn] *Dynamic Bayesian Network - Partical Filter

    涉及的一些知识: 机器人的自我定位 Sequential Importance Sampling Ref: http://scipy-cookbook.readthedocs.io/items/Par ...

  2. [Scikit-learn] Dynamic Bayesian Network - Conditional Random Field

    李航,第十一章,条件随机场 参考:[PGM] Markov Networks 携代码:用 Python 通过马尔可夫随机场(MRF)与 Ising Model 进行二值图降噪[推荐!] CRF:htt ...

  3. [Scikit-learn] Dynamic Bayesian Network - HMM

    Warning The sklearn.hmm module has now been deprecated due to it no longer matching the scope and th ...

  4. (转) How a Kalman filter works, in pictures

    How a Kalman filter works, in pictures I have to tell you about the Kalman filter, because what it d ...

  5. 概率图模型(PGM):贝叶斯网(Bayesian network)初探

    1. 从贝叶斯方法(思想)说起 - 我对世界的看法随世界变化而随时变化 用一句话概括贝叶斯方法创始人Thomas Bayes的观点就是:任何时候,我对世界总有一个主观的先验判断,但是这个判断会随着世界 ...

  6. Learning Bayesian Network Classifiers by Maximizing Conditional Likelihood

    Abstract Bayesian networks are a powerful probabilistic representation, and their use for classifica ...

  7. 卡尔曼滤波器 Kalman Filter (转载)

    在学习卡尔曼滤波器之前,首先看看为什么叫“卡尔曼”.跟其他著名的理论(例如傅立叶变换,泰勒级数等等)一样,卡尔曼也是一个人的名字,而跟他们不同的是,他是个现代人! 卡 尔曼全名Rudolf Emil ...

  8. 卡尔曼滤波—Simple Kalman Filter for 2D tracking with OpenCV

    之前有关卡尔曼滤波的例子都比较简单,只能用于简单的理解卡尔曼滤波的基本步骤.现在让我们来看看卡尔曼滤波在实际中到底能做些什么吧.这里有一个使用卡尔曼滤波在窗口内跟踪鼠标移动的例子,原作者主页:http ...

  9. (二). 细说Kalman滤波:The Kalman Filter

    本文为原创文章,转载请注明出处,http://www.cnblogs.com/ycwang16/p/5999034.html 前面介绍了Bayes滤波方法,我们接下来详细说说Kalman滤波器.虽然K ...

随机推荐

  1. Java IP地址字符串与BigInteger的转换, 支持IPv6

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 3 ...

  2. Java web项目中java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

    原来是tomcat找不到MYSQL JAR包的问题.后来又把mysql-connector-java-5.1.7-bin.jar导入到tomcat的lib目录下面就ok了,嘿…… 在java项目中,只 ...

  3. HTML源文件编码的问题

    刚才使用sublime text编辑html文件,在html中使用meta tag指定了charset,如下 <meta http-equiv="content-type" ...

  4. 一款基于css3的简单的鼠标悬停按钮

    今天给大家分享一款基于css3的简单的鼠标悬停按钮.这款悬停按钮鼠标经过前边框是间断的.当鼠标经过的时候边框间隔消失.效果图如下: 在线预览   源码下载 实现的代码. html代码: <div ...

  5. 【Unity/Kinect】获取预制的手势信息KinectInterop.HandState

    Kinect使用了枚举KinectInterop.HandState来描述手势. 该手势指的是手掌的状态(张开/握拳),而不是说整个手臂的肢体动作(Gesture). 同样是需要嵌套在Kinect获取 ...

  6. 启动haoop并运行wordcount

    启动hadoop,这里hadoop的版本是2.7.4 进入Hadoop的安装目录的bin目录下,采用-format命令格式化文件系统. hadoop namenode -format hadoop d ...

  7. Fastjson 的简单使用<转>

    简介 Fastjson是一个Java语言编写的高性能功能完善的JSON库. 高性能 fastjson采用独创的算法,将parse的速度提升到极致,超过所有json库,包括曾经号称最快的jackson. ...

  8. Eclipse 中link一个异地的Folder

    Eclipse 中link一个外地的Folder New -> Folder -> Click "Advanced" --> Check "Link t ...

  9. Spark SQL怎么创建编程创建DataFrame

    创建DataFrame在Spark SQL中,开发者可以非常便捷地将各种内.外部的单机.分布式数据转换为DataFrame.以下Python示例代码充分体现了Spark SQL 1.3.0中DataF ...

  10. 不可错过的10个超棒jQuery表单操作代码片段

    jQuery 绝对是一个伟大的开源javascript类库,是帮助我们快速和高效开发前端应用的利器.可能大家在日常的开发过程中常常会处理表单相关的 javascript,在今天这篇代码片段分享文章中, ...