We need to talk about some information theory concepts that are important in machine learning. For illustration, in polynomial regression using least square estimation we already talk here, we define our error as “square error” . In information theory point of view, we can define as an entropy for example, that is used in learning process of decision tree. Ok, let’s talk one by one those important concepts.
(1) Unit of information
How to measure an information? Shannon propose well-known concept that is used until now, namely Shannon entropy. In short, we can say entropy is how many information units (such as bit) are needed to represent certain information or event. Or in more formal way, we can define as “the average amount of information produced by a probabilistic stochastic source of data”.
For example we have a tossing coin event with and , how many units of information we need to represent that event (random variable )? We can measure it using this Shannon entropy as follows.
Using (basis of log), we get:
Because we use , which is same with binary system, we can say that the result above is in unit bit. So, to represent that tossing coin event, we need 1 bit. Next, what is another meaning behind this? See table below providing some samples of event 1, 2, and 3 whose outcomes are ternary with each probability value .
Table above shows that the distribution which maximizes entropy is uniform distribution, which is event 1. And more variation the probability values, lower entropy it is, a.k.a less unit number (e.g: bit) we need to represent that event. It makes sense, if you know Huffman coding, event 3 will also have least average length of bit.
(2) Proofing that uniform distribution maximizes entropy
Let’s try to prove mathematically that uniform distribution is the distribution of probabilities that maximizes entropy.
will be maximal when is uniform distribution?
We can prove it using calculus of variation, but it will be relatively difficult. Another way to prove it is using Lagrange multiplier. In short, it is an optimization method to find maximal/minimal value subject to equality constraints. In this case, our constraint is . By adding this constraint to our equation to be maximized, it will be as follows, and let it denoted by just to make it easier to explain.
The second term is our equality constraint, and we have , that is our Lagrange multiplier. And here, we change to to make the proofing easier, since the basis in entropy is freely defined up to us. We will take first differential w.r.t , and make it equal to zero to get the extrema value. Here we go.
We change the integral to sigma (continuous to discrete) first, so that we can easily get the intuitive meaning during this proofing process. By proceeding the process, we get.
From to , the normal differential () changes to partial differential () because that is special case of Leibniz rule. Again, from to , in the first term, we use differential product rule . In , we get Kronecker delta . We can think that sigma is summation expansion, so that we take differential for each term in that summation expansion, and we will only have differential value when index . Thus, Kronecker delta will cancel out sigma summation and we get from .
And the last step, to get what is, we can just re-plug to our constraint.
Voila! We just successfully proved that that maximizes our is uniform distribution .
(3) Given additional constrain, mean, what is the distribution maximizing entropy?
Let’s give additional constrain to our , which is mean as follows.
Again, we will take the first differential w.r.t , and make it equal to zero to find the extrema value. We already familiar to do functional differentiation (differentiate w.r.t a function) in the previous proofing, thus, we just skip the detail for later proofing. Here we go.
Next, we will find by re-plugging to our two constraints. Here we go.
To be converged, has to be negative. Thus:
We proceed to plug to our second constraint.
We will use integral by parts () to solve equation above. Let and . Thus:
Re-plugging to our last equation, we get:
Again, equation above will be converged when is negative, and as a consequence, the first term will be zero. Let’s continue to re-write again.
Yes, we almost get it! Our , where according to what we already get before, in solving constraint 1. Thus, our is:
According to the final we get, we can say that given additional constrain , probability that maximizes entropy is exponential distribution.
(4) Given additional constrain again, variance, what is the distribution maximizing entropy?
In previous discussion, we already proof that given additional constraint mean, exponential distribution maximizes entropy. Now, what if we are given additional constraint again, which is variance? Here is our additional equality constraint.
We already derive with two constraints (sum of probability =1 and mean constraint), thus, by adding third term with our variance constraint, we will get as follows.
To find , we can use Jacobian and polar coordinate system. By doing that, we will get that the distribution that maximizes entropy in this case is Gaussian distribution. That’s why Gaussian is beautiful and important distribution. In later discussion, about online learning, we will encounter that conjugate of Gaussian is another Gaussian (self-conjugate). Interesting, right?
(5) Conditional entropy
We already familiar with the term “conditional” in deriving Naive Bayes here. It’s similar in the entropy here. Conditional entropy is the amount of information needed to describe the outcome of a random variable given that the value of another random variable is known.
Given random variable , conditional entropy of given is defined as sum of for each possible of , using as the weights. Let’s write and derive it.
From to , we substitute using definition of entropy. From to , we use Bayes’ formula. From to , we also use Bayes’ formula.
(5) Relative entropy
Relative entropy, also called Kullback–Leibler divergence, is a measure of how one probability distribution diverges from the other one. Relative entropy to is defined as follows.
Note that . Thus, for implementation, we can come up with:
(6) Mutual information
Mutual information of two random variables measures the mutual dependence between those two variables. More specifically, it quantifies the “amount of information” (e.g: bits) obtained about one random variable, through the other random variable. Mathematically, it is defined as follows.