Discussion: April 22nd
Deadline: April 21st, 23:59
NOTE the changed deadline!! To give Jens a chance to look at the submissions before the exercise, the deadline will now be the evening before the exercise!
Consider a dangerous and/or common illness that people are being tested for to recognize it early (e.g. cancer) and/or prevent its spread (e.g. COVID). The test is either positive or negative. We make the following assumptions:
You take part in a study where a random, representative sample of the population is tested for the illness. Your test result is positive. What is the probability that you have the illness?
Next (mathematical solution is sufficient, no need for more simulation):
As we can see, the second test is much more prone to errors than the first.
However, assume that the results of the second test are independent of the
first. That is, whether the second test makes an error does not depend
on whether there is an error on the first test and vice versa.
Now, both of your tests come back positive. Given this information,
what is the probability that you are indeed sick?
So far we have mainly looked at conditional distributions of the kind p(x|y),
i.e. “probability of data given label” or something similar. There is a different
kind, however: Consider high-dimensional data x = (x1, x2, ..., xn). Often we need
to ask (and answer): What is p(x1 | x2, ..., xn) (or any other combination)?
Let us then consider a simpler special case: A mixture of Gaussians. You are familiar with the basic multidimensional Gaussian distribution; a mixture of Gaussians is simply a weighted sum of different Gaussians, each with its own mean and covariance matrix.
x1, x2) and isotropic Gaussians – here, the
different dimensions are independent and have the same variance. Technically
speaking, the covariance matrix is a constant times the identity matrix.p(x1|x2). Read
this Stackexchange answer
on the topic.p(x1|x2)? Give
a general answer (formula) that is simplified as much as possible.mu = (1, -1) are the per-dimension means, and sigma = 1 is the
standard deviation.p(x1 = 0.5 | x2 = -0.3)?p(x1 = 1.5 | x2 = -0.3)?mu1 = (1, 1) and the second one has
mu2 = (-1, -1). Both components have sigma = 0.5. The prior mixture weights are
0.5, i.e. both components are weighted equally.p(x1 = 0.5 | x2 = -0.3)?p(x1 = 1.5 | x2 = -0.3)?p(x1 = -0.5 | x2 = -0.3)?Note: To compute the actual probabilities of Gaussians, you can of course use
software such as scipy. See here
– the pdf function should be useful.
For the mathematics parts of this assignment, you can hand them in a separate document (i.e. not a Jupyter notebook). A photograph of an on-paper solution is okay, but it has to be high quality and clearly readable. Better alternatives would be a document with a hand-written solution on something like a tablet, or, best, using a typesetting program like LaTeX capable of producing mathematical formulas.