Cleaned up description of Bayes rule.

I was liberally mixing the terms evidence and likelihood - using the
former for the latter.
This commit is contained in:
Roger Labbe 2015-08-23 13:51:03 -07:00
parent 43b55214a8
commit 6515336f5e
3 changed files with 1838 additions and 1829 deletions

File diff suppressed because one or more lines are too long

View File

@ -753,7 +753,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The algebra for this is not extremely hard, but it is messy. It uses Bayes theorem to compute the posterior (new Gaussian) given the prior (old Gaussian) and evidence (the measurement. I've placed the math at the bottom of the chapter if you are interested in the details. Here I will present the results. The subscript $\\mathtt{z}$ stands for the *measurement*.\n",
"The algebra for this is not extremely hard, but it is messy. It uses Bayes theorem to compute the posterior (new Gaussian) given the prior (old Gaussian) and the likelihood (the probability for the measurement). I've placed the math at the bottom of the chapter if you are interested in the details. Here I will present the results. The subscript $\\mathtt{z}$ stands for the *measurement*.\n",
"$$\\begin{aligned}\n",
"\\mathcal{N}(\\mu_\\mathtt{posterior}, \\sigma_\\mathtt{posterior}^2) &= \\mathcal{N}(\\mu_\\mathtt{prior}, \\sigma_\\mathtt{prior}^2)\\times \\mathcal{N}(\\mu_\\mathtt{z}, \\sigma_\\mathtt{z}^2) \\\\\n",
"&= \\mathcal{N}(\\frac{\\sigma_\\mathtt{prior}^2 \\mu_\\mathtt{z} + \\sigma_\\mathtt{z}^2 \\mu_\\mathtt{prior}}{\\sigma_\\mathtt{prior}^2 + \\sigma_\\mathtt{z}^2},\\frac{1}{\\frac{1}{\\sigma_\\mathtt{prior}^2} + \\frac{1}{\\sigma_\\mathtt{z}^2}})\n",
@ -2787,7 +2787,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.4.1"
"version": "3.4.3"
}
},
"nbformat": 4,

View File

@ -1394,7 +1394,7 @@
"source": [
"It won't be clear until the next chapter how I calculate this covariance. Ignore the calculation, and think about what this implies. We have no easy way to say where the object really is because we are so uncertain about the velocity. Hence the ellipse stretches very far in the x-axis. Our uncertainty in velocity of course means it is also very spread in the y-axis. But as I said in the last paragraph, position and velocity is correlated. *If* the velocity is 5 m/s the next position would be 5, and *if* the velocity is 10 the next position would be 10. They are extremely correlated, so the ellipse must be very narrow. \n",
"\n",
"This superposition of the two covariances is where the magic happens. The only reasonable estimate at time t=1 (where position=5) is roughly the *intersection* between the two covariance matrices! More exactly, we can use the math from the last section and *multiply* the two covariances together. From a Bayesian point of view we multiply the prior with the evidence to get the posterior. If we multiply the position covariance with the velocity covariance using the Bayesian equations we get the result shown in the next chart."
"This superposition of the two covariances is where the magic happens. The only reasonable estimate at time t=1 (where position=5) is roughly the *intersection* between the two covariance matrices! More exactly, we can use the math from the last section and *multiply* the two covariances together. From a Bayesian point of view we multiply the prior with the probability of the evidence (the *likelihood*) to get the posterior. If we multiply the position covariance with the velocity covariance using the Bayesian equations we get the result shown in the next chart."
]
},
{
@ -1448,7 +1448,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"In summary we have taken advantage of the geometry and correlations of the system to produce a very accurate estimate. The math does not care whether we are working with two positions, or a position and a correlated velocity, or if these are spatial dimensions. If floor space is correlated to house price you can write a Kalman filter to track house prices. If age is correlated to disease incidence you can write a Kalman filter to track diseases. If the zombie population is inversely correlated with the number of shotguns then you can write a Kalman filter to track zombies. I showed you this in terms of geometry and talked about *triangulation*. That was just to build your intuition. Get used to thinking of these as Gaussians with correlations. If we can express our uncertainties as a multidimensional Gaussian we can then multiply the prior with the evidence and get a much more accurate result. "
"In summary we have taken advantage of the geometry and correlations of the system to produce a very accurate estimate. The math does not care whether we are working with two positions, or a position and a correlated velocity, or if these are spatial dimensions. If floor space is correlated to house price you can write a Kalman filter to track house prices. If age is correlated to disease incidence you can write a Kalman filter to track diseases. If the zombie population is inversely correlated with the number of shotguns then you can write a Kalman filter to track zombies. I showed you this in terms of geometry and talked about *triangulation*. That was just to build your intuition. Get used to thinking of these as Gaussians with correlations. If we can express our uncertainties as a multidimensional Gaussian we can then multiply the prior with the likelihood and get a much more accurate result. "
]
},
{
@ -1485,7 +1485,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.4.1"
"version": "3.4.3"
}
},
"nbformat": 4,