Probability for Machine Learning
Table of Contents
Example
$$ P(x=1)=P(x=2)= \;\dotsb \;= P(x=6) = \frac{1}{6} $$
$$ E[x]=
\begin{cases}
\; \sum\limits_{x}xP(x) & \quad \text{discrete}\\
\; \int_{x} xP(x)dx & \quad \text{continuous}
\end{cases}$$
Example
$$
\begin{align*}
\text{Sample mean} \quad E[x] &= \sum\limits_{x}x\cdot\frac{1}{m}\;\;(\because\;\text{uniform distribution assumed})\\\\
\text{Variance} \quad \text{var}[x] &=E\left[\left(x-E[x]\right)^2 \right]\;\text{: mean square deviation from mean}
\end{align*}$$
$$ P_{X_1,\cdots,X_n}(X_1=x_1,\cdots,X_n=x_n)$$
$$
\begin{align*}
P_{X_1}(X_1&=x_1)\\
P_{X_2}(X_2&=x_2)\\
&\vdots\\
P_{X_n}(X_n&=x_n)
\end{align*}
$$
$$P_{X_1 \mid X_2}(X_1=x_1 \mid X_2=x_2) = \frac{P(X_1=x_1,X_2=x_2)}{P(X_2=x_2)}: \qquad \text{Conditional prob. of $x_1$ given $x_2$}$$
$$\begin{align*}
P(X_1=x_1 \mid X_2=x_2) &=P(X_1=x_1) \\\\ &\updownarrow \\\\
P(X_2=x_2 \mid X_1=x_1) &=P(X_2=x_2) \\\\ &\updownarrow \\\\
P(X_1=x_1,X_2=x_2) & = P(X_1=x_1)P(X_2=x_2)
\end{align*}$$
Example
$$\begin{align*}x&=\omega_1+\omega_2\;\;\; \text{: sum of the first two dice}\\\\
y&=\omega_1+\omega_2+\omega_3+\omega_4\;\;\; \text{: sum of all four dice} \\\\
&\text{probability of } \begin{bmatrix}x\\y\end{bmatrix}=\;? \\
\end{align*}$$
$$ P_X(x) = \sum\limits_{y}P_{XY}(x,y)$$
$$P_{X \mid Y}(x \mid y =19) =\;?$$
Example
$\;\;$ 1) We take one ball, what is the probability that it is white? (white = 1)
$$ P(X_1=1)=\frac{2}{3} $$$\;\;$ 2) When a white ball has been drawn at the first, what is the probability of drawing a white ball at the second as well?
$$ P(X_2=1 \mid X_1=1) = \frac{1}{2}$$$\;\;$ 3) When two balls have been drawn from two different bins, what is the probability of drawing two white balls?
$$ P(X_1=1,X_2=1)=P(X_2=1 \mid X_1 = 1)P(X_1=1)=\frac{1}{2}\cdot\frac{2}{3}=\frac{1}{3}$$
$$
\begin{align*}
P(X_2,X_1) &= P(X_2 \mid X_1)P(X_1) = P(X_1 \mid X_2)P(X_2)\\ \\
\therefore \;\; P(X_2 \mid X_1) &= \frac{P(X_1 \mid X_2)P(X_2)}{P(X_1)}
\end{align*}$$
Example
$$
\begin{align*}
X &\mapsto Y =aX\\\\
E[aX] &=aE[X]\\
\text{var}(aX) &= a^2 \text{var}(X) \\ \\
\text{var}(X) &= E[(X-E[X])^2]=E[(X-\bar{X})^2]=E[X^2-2X\bar{X}+\bar{X}^2]\\
&=E[X^2]-2E[X\bar{X}]+\bar{X}^2 = E[X^2]-2E[X]\bar{X}+\bar{X}^2\\
&=E[X^2]-E[X]^2
\end{align*}
$$
$$
\begin{align*}
Z&=X+Y \;\text{(still univariate)}\\\\
E[X+Y] &=E[X]+E[Y]\\
\text{var}(X+Y) &= E[(X+Y-E[X+Y])^2] = E[((X-\bar{X})+(Y-\bar{Y}))^2]\\
&=E[(X-\bar{X})^2]+E[(Y-\bar{Y})^2]+2E[(X-\bar{X})(Y-\bar{Y})]\\
&=\text{var}(X)+\text{var}(Y)+2 \text{cov}(X,Y)\\ \\
\text{cov}(X,Y) &=E[(X-\bar{X})(Y-\bar{Y})]=E[XY-X\bar{Y}-\bar{X}Y+\bar{X}\bar{Y}]\\
&=E[XY]-E[X]\bar{Y}-\bar{X}E[Y]+\bar{X}\bar{Y}=E[XY]-E[X]E[Y]
\end{align*}
$$
$$\text{var}(X+Y)=\text{var}(X)+\text{var}(Y)+2 \text{cov}(X,Y)$$
$$\text{cov}(x,y) = E[(x-\mu_x)(y-\mu_y)]$$
$$ \begin{align*} \text{cov}(X) = E[(X-\mu)(X-\mu)^T] &=\begin{bmatrix}\text{cov}(X_1,X_1) & \text{cov}(X_1,X_2)\\\text{cov}(X_2,X_1) & \text{cov}(X_2,X_2)\end{bmatrix}\\
&=\begin{bmatrix}\text{var}(X_1) & \text{cov}(X_1,X_2)\\\text{cov}(X_2,X_1) & \text{var}(X_2)\end{bmatrix}\end{align*}$$
$$ \int x^kP_x(x)dx \;\;\; \text{or} \;\;\; \sum x^kP_x(x)dx $$
$$
\begin{align*}
y &= Ax+b\\\\
E[y] &=AE[x]+b \\
\text{cov}(y) &= A \,\text{cov}(x)\,A^T
\end{align*}
$$
$$ \text{Let} \; x=\begin{bmatrix}x_1\\\vdots\\x_m\end{bmatrix},\quad
\text{then} \; E[x]=\begin{bmatrix}\mu\\\vdots\\\mu\end{bmatrix},\quad
\text{cov}(x) = \begin{bmatrix}
\sigma^2 & & &\\
& \sigma^2 & &\\
& & \ddots &\\
& & & \sigma^2
\end{bmatrix}$$
$$S_m = \frac{1}{m}\sum\limits_{i=1}^m x_i \; \implies
S_m = Ax \;\; \text{where} \; A=\frac{1}{m}\begin{bmatrix}1 & \cdots & 1 \end{bmatrix}$$
$$
\begin{align*}E[S_m] &= AE[x] = \frac{1}{m}\begin{bmatrix}1 & \cdots & 1 \end{bmatrix} \begin{bmatrix}\mu\\\vdots\\\mu\end{bmatrix} = \frac{1}{m}m\mu =\mu \\\\
\text{var}(S_m) &=A \,\text{cov}(x)\,A^T=A\begin{bmatrix}
\sigma^2 & & &\\
& \sigma^2 & &\\
& & \ddots &\\
& & & \sigma^2
\end{bmatrix}A^T=\frac{\sigma^2}{m}
\end{align*}$$
%%javascript
$.getScript('https://kmahelona.github.io/ipython_notebook_goodies/ipython_notebook_toc.js')