Introduction
In this part, we will define some basics of probability theory that are essential for understanding advanced probabilistic machine learning.
Firstly, some notation.
Notation
- Vectors: Bold lowercase, e.g.,
- Matrices: Bold uppercase, e.g.,
- Random variables, vectors, and matrices: Sansserif font, e.g., , ,
- Sets: Calligraphic font, e.g.,
Definition 1 (Discrete Random Variable)
Probability mass function, , with,
The joint distribution of two discrete random variables and is defined as,
The conditional distribution of given is defined as,
The marginal probability distribution of can be found from the joint distribution as,
In general,
Lastly, Bayes’ theorem states that,
Definition 2 (Continuous Random Variable)
Probability density function: Describes the probability of the value of a continuous random variable falling within a given interval.
The probability that falls within the interval is,
Moroever, the following properties (must) hold,
Marginalizatio of with respect to gives,
Recall (Expectation, Variance, and Covariance)
The expectation (or, the average value of under probability distribution ) is defined as,
The sample mean, given points drawn from , is defined as,
with,
For expectations of functions of several variables, we will keep the subscript to indicate the variable averaged over, e.g.,
Further, the conditional expectation is defined as,
The variance (how much variability there is in around its expected value) is defined as,
Thus, the variance of is,
Finally, the covariance of and (the extent to which and vary together) is defined as,
The covariance of two random vectors is defined as,
Probabilities: Frequentist VS. Bayesian
In the frequentist interpretation, the relative frequency of occurrence of an outcome after repeating an experiment a large number of times defines the probability of that outcome,
Only repeatable random events have probabilities in this interpretation!
However, in the Bayesian interpretation, it quantifies the uncertainty of events happening. The probability is a measure of the belief or confidence regarding the occurrence of an event. The prior belief about an event will likely change when new information is revealed.
Example 1
Assume that 90% of people with Kreuzfeld-Jacob (KJ) disease [^1] ate hamburgers. The probability of an individual to have KJ is one in 100,000.
Assuming half of the population eat hamburgers, what is the probability that a hamburger eater will have KJ disease?
Firstly, we define the events having KJ disease as and eating hamburgers as .
Thus, we want to know .
Consider the following population of one million people.
| 9 | 1 | |
| 499,991 | 499,999 |
From the table we see that,
Now,
Intuition (Bayesian Approach)
In the Bayesian approach, we start with our hypothesis (e.g., patient has a disease or not) and our data (e.g., test result or patient symptoms).
We call our prior belief in the hypothesis before looking at any data. is the likelihood of the data if the hypothesis is true. is called the marginal likelihood (commoness of the data). Finally, is our posterior belief in the hypothesis after seeing the data.
Consider the following setup. Let be our observed variables (the data) and be our latent variables (the parameters we want to learn/find). In probabilistic modeling, we treat both observed and latent variables as random variables.
Can we model a relationship between and via ?
Many inference problems are of the form,
Seeing quantities as functions of , can be viewed as a normaliziation constant and we can rewrite the equation as,
Most probable a posterior (maximum a posterior, MAP) setting,
If is constant (i.e., uniform prior), then the MAP estimate reduces to the maximum likelihood (ML) estimate,
Example 2 (Tossing a Biased Coin)
Imagine we have a random variable representing the outcome of tossing a (biased) coin flip (0 = tails, 1 = heads) with unknown bias (i.e., the probability of getting heads).
Thus, the goal is, given a data set estimate , i.e., the probability that a toss will result in heads, .
By applying Bayes’ theorem, we have,
We note that a single coin toss corresponds to a Bernoulli random variable,
with,
Thus, for independent coin tosses,
where is the number of heads observed in the data set . To be explicit, how we went from a product to a sum is by taking the logarithm of the product,
Now, in the frequentist approach, we can estimate by maximizing , i.e., the maximum likelihood estimate 1or, equivalently, maximizing the log-likelihood, since is a monotonic function and does not change the location of the maximum,
By differentiating and equating to zero, we obtian the ML estimator,
i.e., the fraction of heads observed in the data set.
In the Bayesian approach,
with as before.
In this setting, we need to specify a prior for !
Assume with,
for and 2 heads and 8 tails observed, i.e., ,
for with 20 heads and 80 tails observed, i.e., ,
As we can see, as we gather more data, the influence of the prior diminishes and the posterior is dominated by the likelihood.
Now, if we now consider a continuum of parameters?
A flat (uniform) prior ,
Since,
We want to be a distribution,
where the constant is obtained as,
which is the Beta distribution normalization constant.
The beta function is defined as,
and the corresponding beta distribution is defined as,
where is the gamma function [^2].
Further, we can see that, if a prior is proportional to powers of and , then the posterior distribution will have the same functional form as the prior!
A conjugate prior (posterior will be of same functional form as prior),
Then,
Thus, the posterior is also a beta distribution!
where and .
If we do now know anything about the coin, we can choose a uniform prior,
However, our posterior can act as a prior if we subseqently observe additional data, i.e., sequential inference.
Summary
Summary
We conclude this by (re)stating the definition of probabilistic machine learning.
- We treat models and its parameters as random variables.
- Learning does not provide a single model, but a distribution of likely models.
- Can incorporate prior knowledge on model and parameters.