# “Deep learning - Information theory & Maximum likelihood.”

### 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.)
- Random events process more information. (Random dice have more information.)

- Independent events add information. Rolling a dice twice with heads have twice the information of rolling the dice once with a head.

In information theory, chaos processes more information.

Information of an event is defined as:

### Entropy

In information theory, entropy measures the amount of information.

We define entropy as:

So

If 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 .

(Source Wikipedia)

For a fair die, . 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 with distribution using the wrong optimized encoding scheme from .

Cross entropy is defined as:

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

### KL Divergence

In deep learning, we want a model predicting data distribution resemble the distribution 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: .

Recall:

We can rewrite the cross entropy equation with KL divergence:

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

only depends on : the probability distribution of the data. Since it is un-related with the model we build, we can treat 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 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 is monotonic, optimize is the same as optimize . So instead of the MLE, we take the 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, . In real life, we are dealing with un-certainty and in-complete information. So we may model the problem as:

with 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 .

Alternative, we can find the most likely given :

Apply Bayes’ theorem:

To demonstrate the idea, we use a Gaussian distribution of 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.