Information Theory, Inference, and Learning Algorithms

Notes on the Information Theory, Inference, and Learning Algorithms by David J.C. MacKay

Prerequisites

  • Stirling’s approximation of the factorial function: $$ x! \approx x^x e^{-x} $$

  • Binomial: $$ \binom{N}{r} = \frac{N!}{(N-r)!r!} $$

  • Binomial Distribution:

    • Coin has probability $f$ of coming up heads

    • Coin is tossed $N$ times

    • Probability distribution of number of heads $r$ $$ P(r | f, N) = \binom{N}{r} f^r(1-f)^{N-r} $$

    • Mean

      • Sum over all possible numbers of head multiplied by their probabilitites. $$ \Epsilon[r] = \sum_{r=0}^{N} P(r|f,N) r $$
    • Variance $$ \begin{align*} \text{var}[r] & \equiv \Epsilon[(r-\Epsilon[r])^2] \newline & = \Epsilon[r^2] - (\Epsilon[r])^2 \newline & = \sum_{r=0}^{N} P(r|f,N)r^2 - (\Epsilon[r])^2 \newline \end{align*} $$

    • Also $$ \begin{align*} \Epsilon[x+y] & = \Epsilon[x] + \Epsilon[y] & \text{for any random variables } x \text{ and } y \text{.}\newline \text{var}[x+y] & = \text{var}[x] + \text{var}[y] & \text{if } x \text{ and } y \text{ are independent.}\newline \end{align*} $$

    • So $$ \begin{align*} \Epsilon[x+y] & = N f \newline \text{var}[x+y] & = N f (1 - f) \end{align*} $$