View point on probability

What is probability? There are actually at least two different interpretations of probability. One is called the frequentist interpretation. In this view, probabilities represent long run frequencies of events. The other interpretation is called the Bayesian interpretation of probability. In this view, probability is used to quantify our uncertainty about something; hence it is fundamentally related to information rather than repeated trials.

One big advantage of the Bayesian interpretation is that it can be used to model our uncertainty about events that do not have long term frequencies.

Central limit theorem

Consider \(N\) random variables which pdf’s \(p(x)\), each with mean \(\mu\) and variance \(\sigma^2\). We assume each variable is independent and identically distributed or iid for short. Let \(S_N=\sum_{i=1}^NX_i\) be the sum of the rv’s. This is a simple but widely used transformation of rv’s. One can show that, as \(N\) increases, the distribution of this sum approaches

Hence the distribution of the quantity

converges to the standard normal, where \(\bar{X}=\frac{1}{N}\sum_{i=1}^N x_i\) is the sample mean. This is called the central limit theorem.

The Gaussian distribution

The most widely used distribution in statistics and machine learning is the Gaussian or normal distribution. Its pdf is given by

Here \(\mu=\mathbb{E}[X]\) is the mean (and mode), and \(\sigma^2=\text{var}{[X]}\) is the variance. \(\sqrt{2\pi\sigma^2}\) is the normalization constant needed to ensure the density integrates to \(1\).

We write \(X \sim \mathcal{N}(\mu, \sigma^2)\) to denote that \(p(X=x)=\mathcal{N}(x|\mu,\sigma^2)\). If \(X \sim \mathcal{N}(0,1)\), we say \(X\) follows a standard normal distribution. This is sometimes called the bell curve.

The cumulative distribution function or cdf of the Gaussian is defined as

This integral has no closed form expression, but is built in to most software packages. In particular, we can compute it in terms of the error function (erf):

where \(z=(x-\mu)/\sigma\) and

The Gaussian distribution is the most widely used distribution in statistics. There are several reasons for this. First, it has two parameters which are easy to interpret, and which capture some of the most basic properties of a distribution, namely its mean and variance. Second, the central limit theorem tells us that sums of independent random variables have an approximately Gaussian distribution, making it a good choice for modeling residual errors or “noise”. Third, the Gaussian distribution makes the least number of assumptions (has maximum entropy), subject to the constraint of having a specified mean and variance; this makes it a good default choice in many cases. Finally, it has a simple mathematical form, which results in easy to implement, but often highly effective, methods.

Dirac delta function

In the limit that \(\sigma^2 \rightarrow 0\), the Gaussian becomes an infinitely thin spike centered at \(\mu\):

where \(\delta\) is called a Dirac delta function, and is defined as

such that

A useful property of delta functions is the sifting property, which selects out a single term from a sum of integral:

since the integrand is only non-zero if \(x-\mu=0\).

Student t distribution

One problem with the Gaussian distribution is that it is sensitive to outliers, since the log-probability only decays quadratically with distance from the center. A more robust distribution is the Student t distribution. Its pdf is as follows:

where \(\mu\) is the mean, \(\sigma^2 > 0\) is the scale parameter, and \(\nu>0\) is called that the degrees of freedom. The distribution has following properties:

the variance is only defined if \(\nu > 2\). The mean is only defined if \(\nu > 1\).

If \(\nu=1\), this distribution is known as the Cauchy or Lorentz distribution. This is notable for having such heavy tails that the integral that defines the mean does not converge.

To ensure finite variance, we require \(\nu > 2\). It is common to use \(\nu=4\), which gives good performance in a range of problems. For \(\nu \gg 5\), the Student distribution rapidly approaches a Gaussian distribution and loses its robustness properties.

The Laplace distribution

Another distribution with heavy tails is the Laplace distribution, also known as the double sided exponential distribution. This has the following pdf:

Here \(\mu\) is a location parameter and \(b > 0\) is a scale parameter. This distribution has the following properties:

The gamma distribution

The gamma distribution is a flexible distribution for positive real valued rv’s, \(x > 0\). It is defined in terms of two parameters, called the shape \(a > 0\) and the rate \(b > 0\):

where \(\Gamma(a)\) is the gamma function:

The distribution has the following properties:

There are several distributions which are just special cases of the Gamma:

  • Exponential distribution: This is defined by \(\text{Expon}(x|\lambda)\triangleq\text{Ga}(x|1,\lambda)\), where \(\lambda\) is the rate parameter. This distribution describes the times between events in a Poisson process, i.e. a process in which events occur continuously and independently at a constant average rate \(\lambda\).
  • Erlang distribution: This is the same as the Gamma distribution where \(a\) is an integer. It is common to fix \(a=2\), yielding the one-parameter Erlang distribution, \(\text{Erlang}(x|\lambda)=\text{Ga}(x|2,\lambda)\), where \(\lambda\) is the rate parameter.
  • Chi-squared distribution: This is defined by \(\mathcal{X}^2(x|\nu)\triangleq\text{Ga}(x|\frac{\nu}{2},\frac{1}{2})\). This is the distribution of the sum of squared Gaussian random variables. More precisely, if \(Z_i\sim\mathcal{N}(0,1)\), and \(S=\sum_{i=1}^\nu Z_i^2\), then \(S\sim\mathcal{X}_\nu^2\).

Another useful result is the following: If \(X \sim \text{Ga}(a,b)\), then one can show that \(\frac{1}{x}\sim\text{IG}(a,b)\), where \(\text{IG}\) is the inverse gamma distribution defined by

The distribution has these properties:

The mean only exists if \(a>1\). The variance only exists if \(a>2\).

The beta distribution

The beta distribution has support over the interval \([0,1]\) and is defined as follows:

Here \(\text{B}(p,q)\) is the beta function,

We require \(a,b > 0\) to ensure the distribution is integrable (i.e. to ensure \text{B}(a,b) exists). If \(a=b=1\), we get the uniform distribution. If \(a\) and \(b\) are both less than \(1\), we get a bimodal distribution with spikes at \(0\) and \(1\); if \(a\) and \(b\) are both greater than \(1\), the distribution is unimodal. The distribution has the following properties:

Pareto distribution

The Pareto distribution is used to model the distribution of quantities that exhibit long tails, also called heavy tails. The Pareto pdf is defined as follow:

This density asserts that \(x\) must be greater than some constant \(m\), but not too much greater, where \(k\) controls what is “too much”. As \(k \rightarrow \infty\), the distribution approaches \(\delta(x-m)\). If we plot the distribution on a log-log scale, it forms a straight line, of the form \(\log p(x)=a\log x + c\) for some constants \(a\) and \(c\). This is known as a power law. This distribution has the following properties:

Non-Gaussian distributions

  • Super-Gaussian distributions

These are distributions which have a big spike at the mean, and hence (in order to ensure unit variance) have heavy tails. The Laplace distribution is a classic example. Formally, we say a distribution is super-Gaussian or lepokurtic (“lepto” coming from the Greek for “thin”) if \(\text{kurt}(z)>0\), where \(\text{kurt}(z)\) is the kurtosis of the distribution, defined by

where \(\sigma\) is the standard deviation, and \(\mu_k\) is the \(k\)’th central moment, or moment about the mean:

(so \(\mu_1=\mu\)) is the mean, and \(\mu_2=\sigma^2\) is the variance.) It is conventional to subtract \(3\) in the definition of kurtosis to make the kurtosis of a Gaussian variable equal to zero.

  • Sub-Gaussian distributions

A sub-Gaussian or platykurtic (“platy” coming from the Greek for “broad”) distribution has negative kurtosis. These are distributions which are much flatter than a Gaussian. The uniform distribution is a classic example.

  • Skewed distributions

Another way to “be non-Gaussian” is to be asymmetric. One measure of this is skewness, defined by

An example of a (right) skewed distribution is the gamma distribution.

Correlation and covariance

If \(x\) is a \(d\)-dimensional random vector, its covariance matrix is defined to be the following symmetric, positive definite matrix:

Covariances can be between \(0\) and infinity. Sometimes it is more convenient to work with a normalized measure, with a finite upper bound. The (Pearson) correlation coefficient between \(X\) and \(Y\) is defined as

A correlation matrix has the form

One can show that \(-1 \leq \text{corr}[X,Y] \leq 1\). Hence in a correlation matrix, each entry on the diagonal is \(1\), and the other entries are between \(-1\) and \(1\).

One can show that \(\text{corr}[X,Y]=1\) if and only if \(Y=aX+b\) for some parameters \(a\) and \(b\), i.e., if there is a linear relationship between \(X\) and \(Y\). Intuitively one might expect the correlation coefficient to be related to the slope of the regression line, i.e., the coefficient \(a\) in the expression \(Y=aX+b\). However, the regression coefficient is in fact given by \(a=\text{cov}[X,Y]/\text{var}[X]\). A better way to think of the correlation coefficient is as a degree of linearity.

If \(X\) and \(Y\) are independent, meaning \(p(X,Y)=p(X)p(Y)\), then \(\text{cov}[X,Y]=0\), and hence \(\text{corr}[X,Y]=0\) so they are uncorrelated. However, the converse is not true: uncorrelated does not imply independent. A more general measure of dependence between random variables is mutual information. This is only zero if the variables truly are independent.

Entropy

The entropy of a random variable \(X\) with distribution \(p\), denoted by \(\mathbb{H}(X)\) or sometimes \(\mathbb{H}(p)\), is a measure of its uncertainty. In particular, for a discrete variable with \(K\) states, it is defined by

Usually we use log base \(2\), in which case the units are called bits. If we use log base \(e\), the units are called nats.

The discrete distribution with maximum entropy is the uniform distribution. Conversely, the distribution with minimum entropy is any delta-function that puts all its mass on one state. Such a distribution has no uncertainty.

KL divergence

One way to measure the dissimilarity of two probability distributions, \(p\) and \(q\), is known as the Kullback-Leibler divergence or relative entropy. This is defined as follows:

where the sum gets replaced by an integral for pdfs. We can rewrite this as

where \(\mathbb{H}(p,q)\) is called the cross entropy,

One can show that the cross entropy is the average number of bits needed to encode data coming from a source with distribution \(p\) when we use model \(q\) to define our codebook. Hence the regular entropy \(\mathbb{H}(p)=\mathbb{H}(p,p)\) is the expected number of bits if we use the true model, so the KL divergence is the difference between these. In other words, the KL divergence is the average number of extra bits needed to encode the data, due to the fact that we used distribution \(q\) to encode the data instead of the true distribution \(p\).

The “extra number of bits” interpretation should make it clear that \(\mathbb{KL}(p||q)\geq 0\), and that the KL is only equal to zero iff \(q=p\).

Mutual information

Consider two random variables, \(X\) and \(Y\). Suppose we want to know how much knowing one variable tells us about the other. We could compute the correlation coefficient, but this is only defined for real-valued random variables, and furthermore, this is a very limited measure of dependence. A more general approach is to determine how similar the joint distribution \(p(X,Y)\) is to the factored distribution \(p(X)p(Y)\). This is called the mutual information, and is defined as follows:

We have \(\mathbb{I}(X;Y)\geq 0\) with equality iff \(p(X,Y)=p(X)p(Y)\). That is, the MI is zero iff the variables are independent.

to gain insight into the meaning of MI, it helps to re-express it in terms of joint and conditional entropies. One can show that the above expression is equivalent to the following:

where \(\mathbb{H}(Y|X)\) is the conditional entropy, defined as \(\mathbb{H}(Y|X)=\sum_xp(x)\mathbb{H}(Y|X=x)\). Thus we can interpret the MI between \(X\) and \(Y\) as the reduction in uncertainty about \(X\) after observing \(Y\), or, by symmetry, the reduction in uncertainty about \(Y\) after observing \(X\).

A quantity which is closely related to MI is the pointwise mutual information or PMI. For two events \(x\) and \(y\), this is defined as

This is the amount we learn from updating the prior \(p(x)\) into the posterior \(p(x|y)\), or equivalently, updating the prior \(p(y)\) into the posterior \(p(y|x)\).

Classifying documents using bag of words

Document classification is the problem of classifying text documents into different categories. One simple approach is to represent each document as a binary vector, which records whether each word is present or not, so \(x_{ij}=1\) iff word \(j\) occurs in document \(i\), otherwise \(x_{ij}=0\). We can then use the following class conditional density:

This is called the Bernoulli product model, or the binary independence model.

However, ignoring the number of times each word occurs in a document loses some information. A more accurate representation counts the number of occurrences of each word. Specifically, let \(x_i\) be a vector of counts for document \(i\), so \(x_{ij}\in{0,1,\dots,N_i}\), where \(N_i\) is the number of terms in document \(i\) (so \(\sum_{j=1}^Dx_{ij}=N_i\)). For the class conditional densities, we can use a multinomial distribution:

where we have implicitly assumed that the document length \(N_i\) is independent of the class. Here \(\theta_jc\) is the probability of generating work \(j\) in documents of class \(c\); there parameters satisfy the constraint that \(\sum_{j=1}^D\theta_{jc}=1\) for each class \(c\).

Although the multinomial classifier is easy to train and easy to use at test time, it does not work particularly well for document classification. One reason for this is that it does not take into account the burstiness of word usage. This refers the phenomenon that most words never appear in any given document, but if they do appear once, they are likely to appear more than once, i.e., words occur in bursts.

Suppose we simply replace the multinomial class conditional density with the Dirichlet Compound Multinomial or DCM density, defined as follows:

Surprisingly this simple change is all that is needed to capture the burstiness phenomenon. The intuitive reason for this is as follows: After seeing one occurence of a word, say word \(j\), the posterior counts on \(\theta_j\) gets updated, making another occurence of word \(j\) more likely. By contrast, if \(\theta_j\) is fixed, then the occurences of each word are independent. The multinomial model corresponds to drawing a ball from an urn with \(K\) colors of ball, recording its color, and then replacing it. By contrast, the DCM model corresponds to drawing a ball, recording its color, and then replacing it with one additional copy; this is called the Polya urn.

The rich get richer. Also related with the Bose-Einstein condensate.

Credible interval and Confidence interval

In addition to point estimates, we often want a measure of confidence. A standard emasure of donfidence in some (scalar) quantity \(\theta\) is the “width” of its posterior distribution. This can be measured using a \(100(1 - \alpha)%\) credible interval, which is a (contiguous) region \(C=(\mathcal{l}, \mathcal{u})\) (standing for lower and upper) which contains \(1-\alpha\) of the posterior probability mass, i.e.,

There may be many such intervals, so we choose one such that there is \((1-\alpha)/2\) mass in each tail; this is called a central interval.

If the posterior has a known functional form, we can compute the posterior central interval using \(\mathcal{l}=F^{-1}(\alpha/2)\) and \(\mathcal{u}=F^{-1}(1-\alpha/2)\), where \(F\) is the cdf of the posterior.

If we don’t know the functional form, but we can draw samples from the posterior, then we can use a Monte Carlo approximation to the posterior quantiles: we simply sort the \(S\) samples, and find the one that occurs at location \(\alpha/S\) along the sorted list.

People often confuse Bayesian credible intervals with frequentist confidence intervals. However, they are not the same thing. In general, credible intervals are usually what people want to compute, but confidence intervals are usually what they actually compute, because most people are taught frequentist statistics but not Bayesian statistics.

A confidence interval is an interval derived from the sampling distribution of an estimator (whereas a Bayesian credible interval is derived from the posterior of a parameter). More precisely, a frequentist confidence interval for some parameter \(\theta\) is defined by the following expression:

That is, if we sample hypothetical future data \(\tilde{D}\) from \(\theta\), then \((\mathcal{l}(\tilde{D}), \mathcal{u}(\tilde{D}))\), is a confidence interval if the parameter \(\theta\) lies inside this interval \(1-\alpha\) percent of the time.

In Bayesian statistics, we condition on what is known – namely the observed data, \(D\) – and average over what is not known, namely the parameter \(\theta\). In frequentist statistics, we do exactly the opposite: we condition on what is unknown – namely the true parameter value \(\theta\) – and average over hypothetical future data sets \(\tilde{D}\).

p-values considered harmful

Suppose we want to decide whether to accept or reject some baseline model, which we will call the null hypothesis. We need to define some decision rule. In frequentist statistics, it is standard to first compute a quantity called the p-value, which is defined as the probability (under the null) of observing some test statistic \(f(D)\) (such as the chi-squred statistic) that is as large or larger than that actually observed:

This quantity relies on computing a tail area probability of the sampling distribution.

Given the p-value, we define our decision rule as follows: we reject the null hypothesis iff the p-value is less than some threshold, such as \(\alpha=0.05\). If we do reject it, we say the difference between the observed test statistic and the expected test statistic is statistically significant at level \(\alpha\). This approach is known as null hypothesis significance testing, or NHST.

This procedure guarantees that our expected type I (false positive) error rate is at most \(\alpha\). This is sometimes interpreted as saying that frequentist hypothesis testing is very conservative, since it is unlikely to accidently reject the null hypothesis. But in fact the opposite is the case: because this method only worries about trying to reject the null, it can never gather evidence in favor of the null, no matter how large the sample size. Because of this, p-value tend to overstate the evidence against the null, and are thus very “trigger happy”.

In general there can be huge differences between p-values and the quantity that we really care about, which is the posterior probability of the null hypothesis given the data, \(p(H_0|D)\).

Another problem with p-values is that their computation depends on decisions you make about when to stop collecting data, even if these decisions don’t change the data you actually observed.