Bayes Filters
Algorithm
The general Bayesian filter algorithm can be summarized as follows.
The control update is calculated by the following equation.
The measurement update is calculated by the following equation.
Numerical Example
Belief
Let's say we have a robot and it can estimate the state of a door using its camera. The state space for a door is binary, i.e. it is either open or closed. We begin with a uniform belief function, i.e. we assign equal probability to guess whether the door is open or closed.
Measurement
Robot's sensor is noisy, we need to characterize it by some conditional probabilities.
Measurement Z
State X
Measurement Probability
Open
Open
0.6
Closed
Open
0.4
Open
Closed
0.2
Closed
Closed
0.8
The robot is relatively reliable in detecting a closed door which makes a lot of sense. It is a lot easier to develop an algorithm to detect that the door is closed. On the other hand, we have a 40% chance to make a wrong detection when the door is actually open.
Control
Robot's action is also probabilistic, we cannot make the assumption that when the robot tries to open a door, the door will always end up in open state. We have to continue to use conditional probabilities to describe the action outcome.
State X
Previous State X
Control
State Transition Probability
Open
Open
Push
1
Closed
Open
Push
0
Open
Closed
Push
0.8
Closed
Closed
Push
0.2
Another possibility is that the robot does nothing and performs null control.
State X
Previous State X
Control
State Transition Probability
Open
Open
Null
1
Closed
Open
Null
0
Open
Closed
Null
0
Closed
Closed
Null
1
Calculate New Belief
Our state space is discrete, either open or closed, either push or null. We can use a summation instead of integral to calculate our control update. Let's say the robot is performing a null action.
That is equivalent to
Now we can consider the two potential value for , which is either open or closed.
The fact that the is equal to the prior belief should not be surprising to us, because a null action should not change the state of the world. Once we incorporate our measurement update, then our new belief will become more accurate reflection of the true state.
Let's first calculate our normalizer factor.
Now there are two possible states, given that is a given here, just like . We assume that .
Robot sensed the door is opened and it is actually open
Robot sensed the door is opened but it is actually closed
Then our new belief will become
Now for the second state, if we decide to apply $$u{2} = \text{push}$ and $z{2} = \text{open}$$, then we get the following control updates.
Again measurement updates again.
It seems impressive that we have a 98.3% of confidence that the door is opened after the robot sensed that the door is opened twice and performed one push control action. However, if this is a mission critical scenario, 1.7% chance of screwing up is still very significant.
Mathematical Derivation
We need to show that the posterior distribution can be calculated from the corresponding posterior distribution one time step earlier, in order to prove the correctness of Bayes filter algorithm by induction. Let's assume that we correctly initialized the prior belief at time and state is complete.
Applying Bayes rule on
We can find the normalizer by integrating over all the possible values, just like we did before in example above. Now we can exploit the fact that is complete. We are interested in predicting the measurement values. There are no past measurement or control would provide us additional information. This can be expressed by the following conditional independence.
Then we can simplify the the equation 1 as follows.
Hence the new belief is
We need to expand the terms in .
Once again, we we exploit the assumption that our state is complete. This implies if we know , past measurements and controls convey no information regarding the state .
Now we just need to substitute equation 4a into equation 4 to get the final recursive update equation. Also note that control can be safely omitted from the set of conditional variables for randomly chosen controls.
To summarize, the Bayes filter algorithm calculates the posterior over the state conditioned on measurement and control data up to time . The derivation assumes that the world is Markov, that is, the state is complete. Any concrete implementation of this algorithm requires three probability distributions.
Initial belief
Measurement probability
State transition probability
The Markov Assumption
The Markov assumption postulates that past and future data re independent if one knows the current state and it must be complete. The problem is that in real world application, we have no way to know the complete state at any given time. There are many factors that may induce violations of the Markov assumption.
Unmodeled dynamics in the environment are not included in the state, e.g. moving people
Inaccuracies in the probabilistic models and distributions
Approximation errors
Software variables in the robot control software
There are many algorithms and techniques derived from the Bayes filter. Each of them relies on a different assumptions regarding the measurement, state transition probabilities, and the initial belief. The assumptions give rise to different computational characteristics.
Computational efficiency
Accuracy of approximation
Ease of implementation
Last updated