Preliminary Knowledge#
What do you need?#
A basic handling of Calculus, Linear Algebra, and Probability Theory are required to understand the theoretical part of the course.
Exercises and practicing the practical parts of the course require basic handling of Python.
If you are an ardent believer in programming language X, we will not force you to use Python. Problem sets, as well as model solutions, will only be provided in Python, but there is nothing keeping you from doing the exercises in, e.g., Julia, Mojo, Rust, etc.
Sources for Preliminary Reading#
To refresh your memory on the preliminary knowledge required for this course, we strongly recommend the concise, accessible notes from the Dive into Deep Learning online book by Aston Zhang, Zachary C Lipton, Mu Li, and Alexander J Smola.
If you prefer a more expansive book/lecture style, we can furthermore recommend the following chapter from Mathematical Foundations of Machine Learning by Robert Nowak:
Chapter 1: Probability in Machine Learning
Chapter 2: Discrete Probability Distributions and Classification
Exercises to Test Preliminary Knowledge#
If you seek to refresh your memory through exercises, please find below a problem set to test your preliminary knowledge. The solutions to these exercises are split into Part 1 and Part 2.
1. Linear Algebra#
1.1. Moore-Penrose Pseudoinverse: Applied#
Complete the pseudoinverse of the following two matrices:
1.2. Singular Value Decomposition: Applied#
Compute the singular value decomposition of the following two matrices:
1.3. Singular Value Decomposition: Theoretical#
Show that for a matrix \(A\):
The rank of \(A\) is \(r\), where \(r\) is the minimum \(i\) such that \(\underset{\underset{|\bf{v}|=1}{\bf{v} \perp \bf{v_{1}}, \bf{v_{2}}, \ldots, \bf{v_{i}}}}{\arg \max} |A \hspace{1pt} \bf{v} | = 0\).
\(\left| \bf{u}^{T}_{1} A \right| = \underset{|u|=1}{\max} \left| \bf{u}^{T} A \right| = \sigma_{1}\).
Hint: Recall the definition of the singular value decomposition.
2. Probability Theory#
2.1. Variance of a Sum#
Show that the variance of a sum is \(var\left[X + Y\right] = var[X] + var[Y] + 2 cov[X, Y]\), where \(cov[X, Y]\) is the covariance between \(X\) and \(Y\).
2.2. Pairwise Independence Does not Imply Mutual Independence#
We say that two random variables are pairwise independent if
and hence
We say that \(n\) random variables are mutually independent if
and hence
Show that pairwise independence between all pairs of variables does not necessarily imply mutual independence.
Hint: It suffices to give a counter-example.
2.3. Bernoullie Distribution#
The form of the Bernoulli distribution given by
is not symmetric between the two values of x. In some situations, it will be more convenient to use an equivalent formulation for which \(x \in \{-1, 1\}\), in which case the distribution can be written
where \(\mu \in [-1, 1]\). Show that the distribution is normalized, and evaluate its mean, variance, and entropy.
2.4. Beta Distribution#
Prove that the beta distribution, given by
is correctly normalized, so that
holds. This is equivalent to showing that
From the definition of the gamma function, we have
Use expression (22) to prove (21). First bring the integral over y inside the integrand of the integral over x, next make the change of variable \(t = y + x\) where \(x\) is fixed, then interchange the order of the \(x\) and \(t\) integrations, and finally make the change of variable \(x = t \mu\) where \(t\) is fixed.
2.5. Mean, Mode, and Variance of the Beta Distribution#
Suppose \(\theta \sim Beta(a, b)\). Derive the mean, mode, and variance.
Hint: See the definition above and consider the moment-generating function.
2.6. Deriving the Inverse Gamma Density#
Let \(X \sim Ga(a, b)\), i.e.
Let \(Y = 1 / X\). Show that \(Y \sim IG(a, b)\), i.e.
2.7. Normalization Constant for a 1-Dimensional Gaussian#
The normalization constant for a zero-mean Gaussian is given by
where \(a = -\infty\) and \(b=\infty\). To compute this, consider its square
Let us change variables from cartesian \((x, y)\) to polar \((r, \theta)\) using \(x = r \cos \theta\) and \(y = r \sin \theta\). Since \(dx \hspace{1pt} dy = r \hspace{1pt} dr \hspace{1pt} d\theta\), and \(\cos^{2} \theta + \sin^{2} \theta = 1\), we have
Evaluate this integral and hence show \(Z = \sigma \sqrt{2 \pi}\). We suggest separating the integral into a product of two terms, the first of which (involving \(d\theta\)) is constant, so it is easy. Another simplification is possibly by realizing that if \(u = e^{-r^{2}/2\sigma^{2}}\) \(du/dr = - \frac{1}{\sigma^{2}} r \hspace{1pt} e^{-r^{2} / 2\sigma^{2}}\), so the second integral reduces down to \(\int u'(r)dr = u(r)\).
2.8. Kullback-Leibler Divergence#
Evaluate the Kullback-Leibler divergence, expressing the relative entropy of two probability distributions,
between two Gaussians \(p(\bf{x}) = \mathcal{N}(\bf{x} | \bf{\mu}, \bf{\Sigma})\), and \(q(x) = \mathcal{N}(\bf{x} | \bf{m}, \bf{L})\).