This commit is contained in:
Roger Labbe 2015-08-22 11:51:24 -07:00
commit cf740e4d16

View File

@ -515,7 +515,7 @@
"\n",
"belief = np.array([0.1] * 10)\n",
"reading = 1 # 1 is 'door'\n",
"update(hallway, belief, z=1, correct_scale=3.)\n",
"update(hallway, belief, z=reading, correct_scale=3.)\n",
"print('sum =', sum(belief))\n",
"bp.bar_plot(belief)"
]
@ -667,7 +667,7 @@
"source": [
"We can see that we correctly shifted all values one position to the right, wrapping from the end of the array back to the beginning.\n",
"\n",
"You will often see this referred to as the state or system **evolution**, which is short for **time evolution** [7]. Another term is **system propogation**. This term refers to how the state of the system changes over time. For filters, this time is usually discrete. For our dog tracking, the system state is the position of the dog, so the state evolution is the position after a discrete amount of time has passed. I haven't defined 'state' or 'system' yet, but I hope it is clear in context. The **system** is what we are trying to model or filter, and the state is it's current configuration or value. Except in simulations we rarely know the actual state, so we say our filters produce the **estimated state** of the system. In practice this often gets called the state, so be careful to understand if the reference is to the state of the filter (which is the estimated state), or the state of the system (which is the actual state).\n",
"You will often see this referred to as the state or system **evolution**, which is short for **time evolution** [7]. Another term is **system propogation**. This term refers to how the state of the system changes over time. For filters, this time is usually discrete. For our dog tracking, the system state is the position of the dog, so the state evolution is the position after a discrete amount of time has passed. I haven't defined 'state' or 'system' yet, but I hope it is clear in context. The **system** is what we are trying to model or filter, and the state is its current configuration or value. Except in simulations we rarely know the actual state, so we say our filters produce the **estimated state** of the system. In practice this often gets called the state, so be careful to understand if the reference is to the state of the filter (which is the estimated state), or the state of the system (which is the actual state).\n",
"\n",
"More terminology - this prediction becomes our new **prior**. Time has moved forward and we made a prediction without benefit of knowing the measurements. "
]
@ -915,7 +915,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"All of the elements are unchanged except the middle ones, which is correct. The value in position 4 should be $0.8*0.05 + 0.1*0.05 + 0.8 *.05 = 0.1$, which it does. Position 5 should be $0.8*.55 + 0.1*.05 + 0.1*.05=0.45$, which it does. Finally, position 6 is computed the same as position 4, and it is also correct.\n",
"All of the elements are unchanged except the middle ones, which is correct. The value in position 4 should be $0.1 * 0.05 + 0.8 * 0.05 + 0.1 * 0.55 = 0.1$, which it does. Position 5 should be $0.1 * 0.05 + 0.8 * 0.55 + 0.1 * 0.05 = 0.45$, which it does. Finally, position 6 is computed the same as position 4, and it is also correct.\n",
"\n",
"Finally, let's ensure that it shifts the positions correctly for movements greater than one."
]
@ -1714,7 +1714,7 @@
"source": [
"## Total Probability Theorem\n",
"\n",
"We know now the formal mathematics behind the `update()` function; what about the `predict()` function? `predict()` implements the **total probability theorem**. Let's recall what `predict()` computed. It computed the probability of being at any given position given the probability of all the possible movement events. Let's express that as an equation. The probability of being at any position $i$ at time $t$ can be written as $P(X_i^t)$. We computed that as the sum of the prior at time $t$-1 $P(X_i^{t-1})$ multiplied by the probability of moving from cell $x_j$ to $x_i$. That is\n",
"We know now the formal mathematics behind the `update()` function; what about the `predict()` function? `predict()` implements the **total probability theorem**. Let's recall what `predict()` computed. It computed the probability of being at any given position given the probability of all the possible movement events. Let's express that as an equation. The probability of being at any position $i$ at time $t$ can be written as $P(X_i^t)$. We computed that as the sum of the prior at time $t-1$ $P(X_i^{t-1})$ multiplied by the probability of moving from cell $x_j$ to $x_i$. That is\n",
"\n",
"$$P(X_i^t) = \\sum_j P(X_i^{t-1}) P(x_i | x_j)$$\n",
"\n",
@ -1743,7 +1743,7 @@
"\n",
"If you followed the math carefully you will realize that all of this math is exact. The bar charts that we are displaying are not an *estimate* or *guess* - they are mathematically exact results that exactly represent our knowledge. The knowledge is probabilistic, to be sure, but it is exact, and correct.\n",
"\n",
"Furthermore, through basic reasoning we were able to discover two extremely important theorems: Bayes theorem and the total probability theorem. I hope you spent time on those section as in almost any other source they will express filtering algorithms in terms of these two theorems. It will be your job to understand what these equations mean and how to turn them into code. \n",
"Furthermore, through basic reasoning we were able to discover two extremely important theorems: Bayes theorem and the total probability theorem. I hope you spent time on those sections as in almost any other source they will express filtering algorithms in terms of these two theorems. It will be your job to understand what these equations mean and how to turn them into code. \n",
"\n",
"This book is mostly about the Kalman filter. In the g-h filter chapter I told you that the Kalman filter is a type of g-h filter. It is also a type of Bayesian filter. It also uses Bayes theorem and the total probability theorem to filter data, although with a different set of assumptions and conditions than used in this chapter.\n",
"\n",