Skip to content

Commit f1c38ad

Browse files
authored
Merge pull request #264 from bmlip/Gaussian-30Nov
Update The Gaussian Distribution.jl
2 parents a7cddd1 + 86a8c1f commit f1c38ad

File tree

1 file changed

+12
-21
lines changed

1 file changed

+12
-21
lines changed

lectures/The Gaussian Distribution.jl

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
### A Pluto.jl notebook ###
2-
# v0.20.19
2+
# v0.20.21
33

44
#> [frontmatter]
55
#> image = "https://github.com/bmlip/course/blob/v2/assets/figures/fig-linear-system.png?raw=true"
@@ -69,7 +69,7 @@ md"""
6969
* [Ariel Caticha - 2012 - Entropic Inference and the Foundations of Physics](https://github.com/bmlip/course/blob/main/assets/files/Caticha-2012-Entropic-Inference-and-the-Foundations-of-Physics.pdf), pp.30-34, section 2.8, the Gaussian distribution
7070
* References
7171
72-
* [E.T. Jaynes - 2003 - Probability Theory, The Logic of Science](http://www.med.mcgill.ca/epidemiology/hanley/bios601/GaussianModel/JaynesProbabilityTheory.pdf) (best book available on the Bayesian view on probability theory)
72+
* [E.T. Jaynes - 2003 - The central, Gaussian or normal distribution, ch.7 in: Probability Theory, The Logic of Science](https://github.com/bmlip/course/blob/main/assets/files/Jaynes%20-%202003%20-%20Probability%20theory%20-%20ch-7%20-%20Gaussian%20distribution.pdf) (Very insightful chapter in Jaynes' book on the Gaussian distribution.)
7373
7474
"""
7575

@@ -123,7 +123,7 @@ md"""
123123
124124
##### Solution
125125
126-
- See later in this lecture.
126+
- See [later in this lecture](#Challenge-Revisited:-Gaussian-Density-Estimation).
127127
"""
128128

129129
# ╔═╡ 71f1c8ee-3b65-4ef8-b36f-3822837de410
@@ -203,7 +203,7 @@ Why is the Gaussian distribution so ubiquitously used in science and engineering
203203
* Any smooth function with a single rounded maximum goes into a Gaussian function, if raised to higher and higher powers. This is particularly useful in sequential Bayesian inference where repeated updates leads to Gaussian posteriors. (See also this [tweet](https://x.com/Almost_Sure/status/1745480056288186768)).
204204
* The [Gaussian distribution has higher entropy](https://en.wikipedia.org/wiki/Differential_entropy#Maximization_in_the_normal_distribution) than any other with the same variance.
205205
* Therefore, any operation on a probability distribution that discards information but preserves variance gets us closer to a Gaussian.
206-
* As an example, see [Jaynes, section 7.1.4](http://www.med.mcgill.ca/epidemiology/hanley/bios601/GaussianModel/JaynesProbabilityTheory.pdf#page=250) for how this leads to the [Central Limit Theorem](https://en.wikipedia.org/wiki/Central_limit_theorem), which results from performing convolution operations on distributions.
206+
* As an example, see [Jaynes, section 7.1.4](https://github.com/bmlip/course/blob/main/assets/files/Jaynes%20-%202003%20-%20Probability%20theory%20-%20ch-7%20-%20Gaussian%20distribution.pdf) for how this leads to the [Central Limit Theorem](https://en.wikipedia.org/wiki/Central_limit_theorem), which results from performing convolution operations on distributions.
207207
208208
209209
2. Once the Gaussian has been attained, this form tends to be preserved. e.g.,
@@ -212,7 +212,7 @@ Why is the Gaussian distribution so ubiquitously used in science and engineering
212212
* The product of two Gaussian functions is another Gaussian function (useful in Bayes rule).
213213
* The Fourier transform of a Gaussian function is another Gaussian function.
214214
215-
See also [Jaynes, section 7.14](http://www.med.mcgill.ca/epidemiology/hanley/bios601/GaussianModel/JaynesProbabilityTheory.pdf#page=250), and the whole chapter 7 in his book for more details on why the Gaussian distribution is so useful.
215+
See also [Jaynes, section 7.14](https://github.com/bmlip/course/blob/main/assets/files/Jaynes%20-%202003%20-%20Probability%20theory%20-%20ch-7%20-%20Gaussian%20distribution.pdf), and the whole chapter 7 in his book for more details on why the Gaussian distribution is so useful.
216216
217217
"""
218218

@@ -245,7 +245,7 @@ for given ``A`` and ``b``, the mean and covariance of ``z`` are given by ``\mu_z
245245
Since a Gaussian distribution is fully specified by its mean and covariance matrix, it follows that a linear transformation ``z=Ax+b`` of a Gaussian variable ``x \sim \mathcal{N}(\mu_x,\Sigma_x)`` is Gaussian distributed as
246246
247247
```math
248-
p(z) = \mathcal{N} \left(z \,|\, A\mu_x+b, A\Sigma_x A^T \right) \,. \tag{SRG-4a}
248+
p(z) = \mathcal{N} \left(z \,|\, A\mu_x+b, A\Sigma_x A^T \right) \,.
249249
```
250250
251251
In case ``x`` is not Gaussian, higher order moments may be needed to specify the distribution for ``z``.
@@ -265,7 +265,7 @@ A commonly occurring example of a linear transformation is the *sum of two indep
265265
Let ``x \sim \mathcal{N} \left(\mu_x, \sigma_x^2 \right)`` and ``y \sim \mathcal{N} \left(\mu_y, \sigma_y^2 \right)``. Prove that the PDF for ``z=x+y`` is given by
266266
267267
```math
268-
p(z) = \mathcal{N} \left(z\,|\,\mu_x+\mu_y, \sigma_x^2 +\sigma_y^2 \right) \tag{SRG-8}
268+
p(z) = \mathcal{N} \left(z\,|\,\mu_x+\mu_y, \sigma_x^2 +\sigma_y^2 \right)
269269
```
270270
271271
@@ -410,8 +410,10 @@ Let ``\theta =\{\mu,\Sigma\}``. Prove that the log-likelihood (LLH) function ``\
410410

411411
# ╔═╡ f008a742-6900-4e18-ab4e-b5da53fb64a6
412412
hide_proof(
413-
414-
md" ```math
413+
md"""
414+
Hint: it may be helpful here to use the matrix calculus rules from the [5SSD0 Formula Sheet](https://github.com/bmlip/course/blob/main/assets/files/5SSD0_formula_sheet.pdf).
415+
416+
```math
415417
\begin{align*}
416418
\log p(D|\theta) &= \log \prod_n p(x_n|\theta) \\
417419
&= \log \prod_n \mathcal{N}(x_n|\mu, \Sigma) \\
@@ -420,7 +422,7 @@ hide_proof(
420422
&= \frac{N}{2}\log |\Sigma|^{-1} - \frac{1}{2}\sum_n (x_n-\mu)^T \Sigma^{-1}(x_n-\mu) + \mathrm{const.}
421423
\end{align*}
422424
```
423-
" )
425+
""" )
424426

425427
# ╔═╡ 75e35350-af22-42b1-bb55-15e16cb9c375
426428
md"""
@@ -674,15 +676,6 @@ md"""
674676
It is important to distinguish between two concepts: the *product of Gaussian distributions*, which results in a (possibly unnormalized) Gaussian distribution, and the *product of Gaussian-distributed variables*, which generally does not yield a Gaussian-distributed variable. See the [optional slides below](#OPTIONAL-SLIDES) for further discussion.
675677
"""
676678

677-
# ╔═╡ 93361b31-022f-46c0-b80d-b34f3ed61d5f
678-
md"""
679-
## Gaussian Distributions in Julia
680-
Take a look at this mini lecture to see some simple examples of using distributions in Julia:
681-
"""
682-
683-
# ╔═╡ bbf3a1e7-9f25-434c-95c7-898648b5bc90
684-
NotebookCard("https://bmlip.github.io/course/minis/Distributions%20in%20Julia.html")
685-
686679
# ╔═╡ b9a7073a-d294-11ef-2330-49ffa7faff21
687680
md"""
688681
$(code_example("Product of Two Gaussian PDFs"))
@@ -3267,8 +3260,6 @@ version = "1.9.2+0"
32673260
# ╟─b9a6ecd2-d294-11ef-02af-37c977f2814b
32683261
# ╟─b9a6f916-d294-11ef-38cb-b78c0c448550
32693262
# ╟─d2bedf5f-a0ea-4604-b5da-adf9f11e80be
3270-
# ╟─93361b31-022f-46c0-b80d-b34f3ed61d5f
3271-
# ╟─bbf3a1e7-9f25-434c-95c7-898648b5bc90
32723263
# ╟─b9a7073a-d294-11ef-2330-49ffa7faff21
32733264
# ╟─45c2fb37-a078-4284-9e04-176156cffb1e
32743265
# ╟─df8867ed-0eff-4a52-8f5e-2472467e1aa2

0 commit comments

Comments
 (0)