当前位置:网站首页>From Bayesian filter to Kalman filter (2)
From Bayesian filter to Kalman filter (2)
2022-07-28 19:14:00 【Learn something】
Previously, we introduced the discrete Bayesian filtering formula and the basic principle of Bayesian , Next, we will introduce Bayesian filtering of continuous random variables , This is what we will use more often in the future
The distribution of continuous random variables is often expressed by probability density , therefore , We set up :
X It's the forecast ,Y Is the measured value , Both are random variables ; Lowercase x , y Is the corresponding specific value
Represents the probability density distribution of the random variable of the predicted value , Characterize its probability distribution , A priori probability distribution
Represents the probability density distribution of the random variable of the measured value —— The probability distribution is used to describe the possibility of the measured value
Probability density distribution of likelihood probability , In random variables X=x Under the premise of ( It's worth it X=x, Guess is the true value ), Predicted value random variable Y<y Probability
Posterior probability density distribution , The measured value is then variable Y=y Under the premise of , How sure is the predicted value ( probability ) yes X<x
Now we directly give the Bayesian filtering formula of continuous random variables , The specific derivation comes to the end , Understand according to the situation
among ,
The denominator is the marginal probability density , It is generally regarded as a constant
Introduce the random variables in probability theory
One dimensional random variables
Distribution function :
discrete : Distribution column and distribution function
Distribution column :
Distribution function :
The distribution function is the integral of the distribution column , The distribution column of discrete random variables is point , The distribution function is stepped
Continuous type : Probability density function and distribution function
Definition of distribution function :
among ,f It represents its probability density function —— Is the derivative of the distribution function
How to get the distribution function and probability density function ? Experimentalize ? Summarize modeling ?
Probability density :
Distribution function :
The distribution function is obtained by integrating the probability density function
Distribution of one-dimensional random variable function
for example :
It is known that
, seek
Distribution function of
At this time, it needs to be analyzed in combination with images ( Suddenly found that these just reviewed knowledge has forgotten , It seems that the understanding is not deep enough , It doesn't use much , It leads to forgetting )
Two-dimensional random variable
In fact, it is equivalent to two random variables ( event ) The intersection of in a region
Conditional probability of two-dimensional random variables :
( To be added )
Bayesian derivation
The measured value is Y=y Under the premise of , Predictive value X<x Probability :
Find the posterior distribution function first
Now let's look at this example of temperature measurement :
1. Single point 、 Continuous random variable
In discrete form , Our subjective probability is divided into T=10 and T=11 These two only discrete points , however , This is obviously rough , And the continuous segment is more accurate , therefore , We can guess like this :
We guess 0 The temperature at all times conforms to N ~(10,1) Such a normal distribution —— The average is 10( The temperature is 10 Nearby fluctuations ), The variance is 1( Range of fluctuations ). Obviously, you can get 10 All nearby are counted , Instead of the discrete type, which has only two desirable values . The mean and variance here include that it conforms to the normal distribution model , All belong to our guess ! The variance reflects our trust in this mean guess , The more novel it is, the more we believe in this average . From this, we get the distribution function and probability density function of subjective probability :

The value measured by the thermometer , At this moment, of course, a data is measured , such as :y=9
Likelihood probability model , There are other possible types 、 Ladder type 、 Normal distribution type , We can take it as normal distribution here
Likelihood probability conforms to N ~(x,0.2), among ,0.2 Is the accuracy of the thermometer ,x Is the predicted value of the current moment

Then the posterior probability distribution can be obtained by using the continuous Bayesian filtering formula
among ,
, That is to say, we need to find infinite integral
The end result is : N ~ (9.0385, 0.038^2), That is, the modified model , It is called a posteriori probability distribution
Summary : We guess the temperature random variable at this time X0 The distribution of is normal , Likelihood probability model also belongs to normal distribution , After continuous Bayesian filtering formula, the modified distribution is obtained , It's still a normal distribution . however , Sometimes what you guess is not necessarily a normal distribution , It could be something else
2. Multipoint 、 Continuous random variable
Allied , For multiple random variables , Just use recursive relations to connect them , It is basically the same as the discrete type , It's just that the distribution column becomes the probability density
raw material :
1. Recurrence relation between random variables
; The relationship between the predicted value and the measured value
f It represents the functional relationship between adjacent random variables , And the following
It's not the same thing , Don't confuse ;h It represents the functional relationship between the random variable corresponding to the true value and the random variable corresponding to the measured value
2. hypothesis X0,Q1,...,Qk, R1,...,Rk Are independent of each other
3. There are observations y1,y2,...,yk
4. Set initial value 、 Distribution law :
~
,
~
,
~
5. Important theorem : The conditions in conditional probability can be logically deduced
Random variables of process noise at each time :Q0,Q1,Q2,...,Qk, That is to say, the noise interference in each prediction may be different ( In Kalman filter, these noises are directly considered to be the same )
Express : Predict the value of the current time according to the data of the previous time , There is prediction error
Random variable of observation noise at each time :R0,R1,R2,...,Rk, That is, the noise interference during each measurement may be different ( In Kalman filter, these noises are directly considered to be the same )
Express : In fact, it reflects the accuracy of the sensor , Known truth value , However, the sensor does not exactly measure the true value , It's the error
Probability density function of process noise random variable at each time :
Probability density function of random variable of observation noise at each time :
wave filtering :
1. Prediction step
What is required is the probability density , One method is to find the distribution function first , Then we can get the probability density function by taking the derivative ;( Another method is convolution )
What is known is X0 Probability density distribution , Now we need to predict X1 Probability density distribution , Find its distribution function first :
![]()
Here is a continuous ( integral ) Split into discrete points ( Sum up ) Carry out operations ( Refer to the definition of integral ), As for why , Estimation is because the most basic starting point of Bayes is the formula of discrete points .
Besides , Continuous distribution , The probability of a single point is actually undetectable !!! But why can it be counted here ???
This step is obviously All probability formula , But why can it be so ?X1 and X0 It's independent , Why? X0 It can be used as X1 The condition of ?
In terms of time , There is X0 And then it came out X1?? Or say The formula of total probability can be used for any complete set , Regardless of whether the two variables are related ??
This is a logical derivation based on the conditions in conditional probability , Because in the condition X0 = v, therefore f(X0) = f(v), Then add the same number on both sides of the previous equation , The equation still holds —— The equation of state is worked out
This step is the transformation of variable roles ! Using random variables Q1 To replace the X1
The basis for this step is : A random variable Q1 and X0 It's independent of each other , Therefore, they do not affect each other , So you can directly remove the condition X0 that will do ( Then the previous logical derivation also used X0=v As a precondition , Here, how can it become dispensable again ?)
This step is also to refer to the definition of integral ; Be careful : This is right v Do integral ,v To traverse all values , The final formula of integration is eliminated v And leave variables u ; There's another trick :
here f It's a probability density function ,F It's a distribution function ,F After derivation, we get f ;
Here we have a double integral , Be careful : In the final formula, only variables are left x, and u and v Because of the integral, it doesn't exist ; thus , The distribution function of the prediction step is obtained ,
Is the condition we know , So just do the double integral to get the result ( It's just an infinite integral , Computers are troublesome )
This step is to derive the distribution function to obtain the probability density function , involves : The method of deriving the integral formula ——
Sum up , According to what is known
The probability density function of the predicted value is derived
, Just do the integral
2. Update step
The prediction step is to find
that will do , What we use directly is the definition and nature of probability , Plus the known initial value X0 Probability density and prediction noise, etc ; The update step reflects the core of Bayesian filtering —— Update with Bayesian formula to find a posterior
The first is to find the likelihood probability , Likelihood probability contains two variables , among x It's formal ( Can be regarded as a constant ), and y Is the real independent variable , So the likelihood probability is about the measured value y Function of ; here y The definite value is obtained through measurement , Then the corresponding likelihood probability value is determined . We have not chosen a specific model to describe the likelihood probability here ( For example, use normal distribution ), But a more general derivation ( Besides , The derivation here is slightly different from that above , Here is the definition of derivative , The above is from the distribution function )
This step is based on the definition of derivative . Is there such a question : It doesn't mean that the accuracy of the sensor is constant , The likelihood probability of how to measure different temperatures is different ? Accuracy is mainly reflected in variance .
This step is based on the properties of continuous random variables and the logical derivation of conditional probability
This step is based on the observation equation
Replace variables ; also R1 And X1 It's independent of each other , Therefore, the condition can be removed directly X1( Similar to the previous situation , Used in the front , Now discarded )
This step is also based on the definition of derivatives
thus , The likelihood probability density is obtained
next , Bring the probability density and likelihood probability density of the predicted value into the Bayesian formula
Again :
Describe the X1 Probability density of random variable , And the single one f It represents the functional relationship between adjacent random variables ,
The probability density of likelihood probability
In this way, the predicted value is successfully corrected with the help of the observed value and Bayesian formula , The posterior probability distribution is obtained , The optimal value of the random variable can be obtained by calculating the mean value
3. iteration
The posterior probability distribution at this time is used to find the prior probability distribution at the next time The basis of , In combination with the equation of state, the prior probability distribution at the next moment can be obtained , The formula reflects ( The derivation process is the same as the prediction step above ):
So you can iterate , The random variables at each time are automatically filtered
Many places are still a little chaotic , Wordy words , It will be supplemented and simplified later
边栏推荐
- Win11怎么调亮度?Win11调屏幕亮度的四种方法
- What if the content of software testing is too simple?
- Structure and working principle of thyristor
- What does real HTAP mean to users and developers?
- How new people get started learning software testing
- FTM module of K60: configure motor, encoder and steering gear
- Open source database innovation in the era of digital economy | the 2022 open atom global open source summit database sub forum was successfully held
- Overview and working principle of single chip microcomputer crystal oscillator
- Is the prospect of software testing dead? Has it entered the cold winter?
- Mongodb database replication table
猜你喜欢

Redis advantages and data structure related knowledge

BM14 链表的奇偶重排

When the new version of easycvr is linked at the same level, the subordinate platform passes up the cause analysis of the incomplete display of the hierarchical directory

UE4.25 Slate源码解读

Youqilin system installation beyondcomare

MES生产管理系统对设备的应用价值

BM16 删除有序链表中重复的元素-II

现代化个人博客系统 ModStartBlog v5.4.0 登录界面改版,新增联系方式

GC garbage collector details

EasyCVR接入设备后播放视频出现卡顿现象的原因分析及解决
随机推荐
Cause analysis and solution of video jam after easycvr is connected to the device
CTR click through rate prediction practice project of advertising recommendation!
SwiftUI 组件之如何实现电话号码掩码隐藏部分的文本字段TextField(教程含源码)
Fundamentals of software testing and development | practical development of several tools in testing and development
C language (high-level) character function and string function + Exercise
When the new version of easycvr is linked at the same level, the subordinate platform passes up the cause analysis of the incomplete display of the hierarchical directory
Youqilin system installation beyondcomare
Applet applet jump to official account page
Self cultivation of Electronic Engineers - when a project is developed
What is the future of software testing? How to learn?
2022年暑假ACM热身练习3(详细)
BM16 delete duplicate elements in the ordered linked list -ii
The ever-changing pointer ----- C language
BM14 链表的奇偶重排
优麒麟系统安装BeyondComare
Getting started with QT & OpenGL
Open source database innovation in the era of digital economy | the 2022 open atom global open source summit database sub forum was successfully held
Swiftui component how to implement textfield of hidden part of phone number mask (tutorial includes source code)
Pytest custom hook function
Three minutes to understand, come to new media
Represents the probability density distribution of the random variable of the predicted value , Characterize its probability distribution , A priori probability distribution
Represents the probability density distribution of the random variable of the measured value —— The probability distribution is used to describe the possibility of the measured value
Probability density distribution of likelihood probability , In random variables X=x Under the premise of ( It's worth it X=x, Guess is the true value ), Predicted value random variable Y<y Probability
Posterior probability density distribution , The measured value is then variable Y=y Under the premise of , How sure is the predicted value ( probability ) yes X<x
The denominator is the marginal probability density , It is generally regarded as a constant 





, seek
Distribution function of 
In fact, it is equivalent to two random variables ( event ) The intersection of in a region 



, That is to say, we need to find infinite integral
; The relationship between the predicted value and the measured value 
It's not the same thing , Don't confuse ;h It represents the functional relationship between the random variable corresponding to the true value and the random variable corresponding to the measured value
~
,
~
,
~ 








here f It's a probability density function ,F It's a distribution function ,F After derivation, we get f ;
Is the condition we know , So just do the double integral to get the result ( It's just an infinite integral , Computers are troublesome )

, Just do the integral
that will do , What we use directly is the definition and nature of probability , Plus the known initial value X0 Probability density and prediction noise, etc ; The update step reflects the core of Bayesian filtering —— Update with Bayesian formula to find a posterior 



Replace variables ; also R1 And X1 It's independent of each other , Therefore, the condition can be removed directly X1( Similar to the previous situation , Used in the front , Now discarded )

Describe the X1 Probability density of random variable , And the single one f It represents the functional relationship between adjacent random variables ,