### Information theory

Information theory quantifies the amount of information present. In information theory, the amount of information is characterized as:

• Predictability:
• Guaranteed events have zero information.
• Likely events have little information. (Biased dice have little information.)
• Independent events add information. Rolling a dice twice with heads have twice the information of rolling the dice once with a head.

Information of an event is defined as:

### Entropy

In information theory, entropy measures the amount of information.

We define entropy as:

So

If $\log$ has a base of 2, it measure the number of bits to encode the information. In information theory, information and random-ness are positively correlated. High entropy equals high randomness and requires more bits to encode it.

### Example

Let’s comput the entropy of a coin. For a fair coin:

Therefore we can use 1 bit to represent head (0 = head) and 1 bit to represent tail (1 = tail).

The entropy of a coin peaks when $p(head)=p(tail)=0.5$.

(Source Wikipedia)

For a fair die, $H(X) = \log_2 6 \approx 2.59$. A fair die has more entropy than a fair coin because it is less predictable.

### Cross entropy

If entropy measures the minimum number of bits to encode information, cross entropy measures the minimum of bits to encode $x$ with distribution $P$ using the wrong optimized encoding scheme from $Q$.

Cross entropy is defined as:

In deep learning, $P$ is the distribution of the true labels, and $Q$ is the probability distribution of the predictions from the deep network.

### KL Divergence

In deep learning, we want a model predicting data distribution $Q$ resemble the distribution $P$ from the data. Such difference between 2 probability distributions can be measured by KL Divergence which is defined as:

So,

(Source Wikipedia.)

KL-divergence is not commutative: $D_{KL}(P \vert \vert Q) \neq D_{KL}(Q \vert \vert P)$.

Recall:

We can rewrite the cross entropy equation with KL divergence:

So cross entropy is the sum of entropy and KL-divergence. Cross entropy $H(P, Q)$ is larger than $H(P)$ since we require extra amount of information (bits) to encode data with less optimized scheme from $Q$ if $P \neq Q$. Hence, KL-divergence is always positive for $P \neq Q$ or zero otherwise.

$H(P)$ only depends on $P$: the probability distribution of the data. Since it is un-related with the model $\theta$ we build, we can treat $H(P)$ as a constant. Therefore, minimizing the cross entropy is equivalent to minimize the KL-divergence.

### Maximum Likelihood Estimation

We want to build a model with $\hat\theta$ that maximizes the probability of the observed data (a model that fits the data the best: Maximum Likelihood Estimation MLE):

However, multiplications overflow or underflow easily. Since $\log(x)$ is monotonic, optimize $log(f(x))$ is the same as optimize $f(x)$. We add the negative sign because the log of a probability invert the direction of $p(x)$. So instead of the MLE, we take the $\log$ and minimize the negative log likelihood (NLL).

NLL and minimizing cross entropy is equivalent:

#### Putting it together

We want to build a model that fits our data the best. We start with the maximum likelihood estimation (MLE) which later change to negative log likelihood to avoid overflow or underflow. Mathematically, the negative log likelihood and the cross entropy have the same equation. KL divergence provides another perspective in optimizing a model. However, even they uses different formula, they both end up with the same solution.

Cross entropy is one common objective function in deep learning.

### Mean square error (MSE)

In a regression problem, $y = f(x; w)$. In real life, we are dealing with un-certainty and in-complete information. So we may model the problem as:

with $\sigma$ pre-defined by users:

The log likelihood becomes optimizing the mean square error:

Many cost functions used in deep learning, including the MSE, can be derived from the MLE.

### Maximum A Posteriori (MAP)

MLE maximizes $p(y \vert x; θ)$.

Alternative, we can find the most likely $θ$ given $y$:

Apply Bayes’ theorem:

To demonstrate the idea, we use a Gaussian distribution of $\mu=0, \sigma^2 = \frac{1}{\lambda}$ as the our prior:

Assume the likelihood is also gaussian distributed:

So for a Gaussian distribution prior and likelihood, the cost function is

which is the same as the MSE with L2-regularization.

If the likeliness is computed from a logistic function, the corresponding cost function is:

Like, MLE, MAP provides a mechanism to derive the cost function. However, MAP can also model the uncertainty into the cost function which turns out to be the regularization factor used in deep learning.

### Nash Equilibrium

In the game theory, the Nash Equilibrium is reached when no player will change its strategy after considering all possible strategy of opponents. i.e. in the Nash equilibrium, no one will change its decision even after we will all the player strategy to everyone. A game can have 0, 1 or multiple Nash Equilibria.

#### The Prisoner’s Dilemma

In the prisoner’s dilemma problem, police arrests 2 suspects but only have evidence to charge them for a lesser crime with 1 month jail time. But if one of them confess, the other party will receive a 12 months jail time and the one confess will be released. Yet, if both confess, both will receive a jail time of 6 months. The first value in each cell is what Mary will get in jail time for each decision combinations while the second value is what Peter will get.

For Mary, if she thinks Peter will keep quiet, her best strategy will be confess to receive no jail time instead of 1 month.

On the other hand, if she thinks Peter will confess, her best strategy will be confess also to get 6 months jail time.

After knowing all possible actions, in either cases, Mary’s best action is to confess. Similarly, Peter should confess also. Therefore (-6, -6) is the Nash Equilibrium even (-1, -1) is the least jail time combined. Why (-1, -1) is not a Nash Equilibrium? Because if Mary knows Peter will keep quiet, she can switch to confess and get a lesser sentence which Peter will response by confessing the crime also. (Providing that Peter and Mary cannot co-ordinate their strategy.)

### Jensen-Shannon Divergence

It measures how distinguishable two or more distributions are from each other.