Lably
Skip to content

Mutual information

Measure of dependence between two variables

  • 16 min read
  • 5 chapters

Related on Lably

Through Random variable, Independence (probability theory) and Pearson correlation coefficient

Not limited to real-valued random variables and linear dependence like the correlation coefficient, MI is more general and determines how different the joint distribution of the pair (X,Y) is from the product of the marginal distributions of X and Y. MI is the expected value of the pointwise mutual information (PMI).

The quantity was defined and analyzed by Claude Shannon in his landmark paper "A Mathematical Theory of Communication", although he did not call it "mutual information". This term was coined later by Robert Fano. Mutual Information is also known as information gain.

Definition

Let (X,Y) be a pair of random variables with values over the space X×Y. If their joint distribution is P(X,Y) and the marginal distributions are PX and PY, the mutual information is defined as

I(X;Y)=DKL(P(X,Y)∥PX⊗PY)

where DKL is the Kullback–Leibler divergence, and PX⊗PY is the outer product distribution which assigns probability PX(x)⋅PY(y) to each (x,y).

Expressed in terms of the entropy H(⋅) and the conditional entropy H(⋅|⋅) of the random variables X and Y, one also has (see relation to conditional and joint entropy):

I(X;Y)=H(X)−H(X|Y)=H(Y)−H(Y|X)

Notice, as per property of the Kullback–Leibler divergence, that I(X;Y) is equal to zero precisely when the joint distribution coincides with the product of the marginals, i.e. when X and Y are independent (and hence observing Y tells you nothing about X). I(X;Y) is non-negative. It is a measure of the price for encoding (X,Y) as a pair of independent random variables when in reality they are not.

If the natural logarithm is used, the unit of mutual information is the nat. If the log base 2 is used, the unit of mutual information is the shannon, also known as the bit. If the log base 10 is used, the unit of mutual information is the hartley, also known as the ban or the dit.

In terms of PMFs for discrete distributions

The mutual information of two jointly discrete random variables X and Y is calculated as a double sum:

I⁡(X;Y)=∑y∈Y∑x∈XP(X,Y)(x,y)log⁡(P(X,Y)(x,y)PX(x)PY(y)),

where P(X,Y) is the joint probability mass function of X and Y, and PX and PY are the marginal probability mass functions of X and Y respectively.

In terms of PDFs for continuous distributions

In the case of jointly continuous random variables, the double sum is replaced by a double integral:

I⁡(X;Y)=∫Y∫XP(X,Y)(x,y)log⁡(P(X,Y)(x,y)PX(x)PY(y))dxdy,

where P(X,Y) is now the joint probability density function of X and Y, and PX and PY are the marginal probability density functions of X and Y respectively.

Sign in to keep reading

4 more chapters are free with a Lably account.

More in Computing and communication