I'm confused about this. (I had already read Jaynes' book and had this confusion, but this post is about the same topic so I decided to ask here.)
In this example, Mr. A has learned the average numbers of red, yellow, and green orders for some past days and wants to update his predictions of today's orders on this information. So he decides that the expected values of his distributions should be equal to those averages, and that he should find the distribution that makes the least assumptions, given those constraints. I at least agree that entropy is a good measure of how little assumptions your distribution makes. The point I'm confused about is how you get from "the average of this number in past observations is N" to "the expected value of our distribution for a future observation has to be N but we should put no other information in it".
First, it is not necessarily true that, after seeing results that have some average value, your distribution will always have that same value. For example, if you are watching a repeated binary experiment and your prior is Laplace's Rule of Succession, your posterior expected value will be close to the average value (your probability for a result will be close to that result's frequency), but not equal to it; and if you have a maximum entropy distribution, like the "poorly informed robot" in Chapter 9 of Jaynes that assigns probability of 1/2^N to each possible sequence of N outcomes, your probability for each result will keep being 1/2 no matter how much information you get!
Second, why are you even finding a distribution that is constrainedly optimal in the first place, rather than just taking your prior distribution over sequences of results and your observations, and using Bayes' Theorem to update your probabilities for future results? Even if you don't know anything other than the average value, you can still take your distribution over sequences of results, update it on this information (eliminating the possible outcome sequences that don't have this average value), and then find the distribution P(NextResult|AverageValue) by integrating P(NextResult|PastResults)P(PastResults|AverageValue) over the possible PastResults. This seems like the correct thing to do according to Bayesian probability theory, and it's very different from doing constrained optimization to find a distribution.
You could say that maximum entropy given constraints is easier than doing the full update and often works well in practice, but then why does it work?
Nice, some connections with why are maximum entropy distributions so ubiquitous:
So the system converges to the maxent invariant distribution subject to constraint, which is why langevin dynamics converges to the Boltzmann distribution, and you can estimate equilibrium energy by following the particle around
In particular, we often use maxent to derive the prior itself (=invariant measure), and when our system is out of equilibrium, we can then maximize relative entropy w.r.t our maxent prior to update our distribution
Mr A manages a widget factory. The factory produces widgets of three colors - red, yellow, green - and part of Mr A’s job is to decide how many widgets to paint each color. He wants to match today’s color mix to the mix of orders the factory will receive today, so he needs to make predictions about how many of today’s orders will be for red vs yellow vs green widgets.
The factory will receive some unknown number of orders for each color throughout the day - red, yellow, and green orders. For simplicity, we will assume that Mr A starts out with a prior distribution under which:
… and then Mr A starts to update that prior on evidence.
You’re familiar with Bayes’ Rule, so you already know how to update on some kinds of evidence. For instance, if Mr A gets a call from the sales department saying “We have at least 40 orders for green widgets today!”, you know how to plug that into Bayes’ Rule:
… i.e. the posterior is still uniform, but with probability mass only on , and the normalization is different to reflect the narrower distribution.
But consider a different kind of evidence: Mr A goes through some past data, and concludes that the average number of red sales each day is 25, the average number of yellow sales is 50, and the average number of green sales is 5. So, Mr A would like to update on the information .
Chew on that for a moment.
That’s… not a standard Bayes’ Rule-style update situation. The information doesn’t even have the right type for Bayes’ Rule. It’s not a logical sentence about the variables , it’s a logical statement about the distribution itself. It’s a claim about the expected values which will live in Mr A’s mind, not the widget orders which will live out in the world. It’s evidence which didn’t come from observing , but rather from observing some other stuff and then propagating information through Mr A’s head.
… but at the same time, it seems like a kind of intuitively reasonable type of update to want to make. And we’re Bayesians, we don’t want to update in some ad-hoc way which won’t robustly generalize, so… is there some principled, robustly generalizable way to handle this type of update? If the information doesn’t have the right type signature for Bayes’ Rule, how do we update on it?
Here’s a handwavy argument: we started with a uniform prior because we wanted to assume as little as possible about the order counts, in some sense. Likewise, when we update on those expected values, we should assume as little as possible about the order counts while still satisfying those expected values.
Now for the big claim: in order to “assume as little as possible” about a random variable, we should use the distribution with highest entropy.
Conceptually: the entropy tells us how many bits of information we expect to gain by observing the order counts. The less information we expect to gain by observing those counts, the more we must think we already know. A 50/50 coinflip has one bit of entropy; we learn one bit by observing it. A coinflip which we expect will come up heads with 100% chance has zero bits of entropy; we learn zero bits by observing it, because (we think) we already know the one bit which the coin flip nominally tells us. One less bit of expected information gain is one more bit which we implicitly think we already know. Conversely, one less bit which we think we already know means one more bit of entropy.
So, to assume as little as possible about what we already know… we should maximize our distribution’s entropy. We’ll maximize that entropy subject to constraints encoding the things we do want to assume we know - in this case, the expected values.
Spelled out in glorious mathematical detail, our update looks like this:
(... as well as the implicit constraints and , which make sure that is a probability distribution. We usually won’t write those out, but one does need to include them when actually calculating .)
Then we use the Standard Magic Formula for maxent distributions which we’re not going to derive here because this is a concepts post, which says
… where the parameters and are chosen to match the expected value constraints and make the distribution sum to 1. (In this case, David's numerical check finds Z 17465.2, )
We have a somewhat-handwavy story for why it makes sense to use this maxent machinery: the more information we expect to gain by observing a variable, the less we implicitly assume we already know about it. So, maximize expected information gain (i.e. minimize implicitly-assumed knowledge) subject to the constraints of whatever information we do think we know.
But to build confidence in that intuitive story, we should check that it does sane things in cases we already understand.
First, what does the maxent construction do when we don’t pass in any constraints? I.e. we don’t think we know anything relevant?
Well, it just gives the distribution with largest entropy over the outcomes, which turns out to be a uniform distribution. So in the case of our widgets problem, the maximum entropy construction with no constraints gives the same prior we specified up front, uniform over all outcomes.
Furthermore: what if the expected number of yellow orders, , were 49.5 - the same as under the prior - and we only use that constraint? Conceptually, that constraint by itself would not add any information not already implied by the prior. And indeed, the maxent distribution would be the same as the trivial case: uniform.
Now for a more interesting class of special cases. Suppose, as earlier, that Mr A gets a call from the sales department saying “We have at least 40 orders for green widgets today!” - i.e. . This is a case where Mr A can use Bayes’ Rule, as we all know and love. But he could use a maxent update instead… and if he does so, he’ll get the same answer as Bayes’ Rule.
Here’s how.
Let’s think about the variable - i.e. it’s 1 if there are 40 or more green orders, 0 otherwise. What does it mean if I claim ? Well, that expectation is 1 if and only if all of the probability mass is on . In other words, is synonymous with (under the distribution).
So what happens when we find the maxent distribution subject to ? Well, the Standard Magic Formula says
… where and are chosen to satisfy the constraints. In this case, we’ll need to take to be (positive) infinitely large, and to normalize it. In that limit, the probability will be 0 on , and uniform on - exactly the same as the Bayes update.
This generalizes: the same construction, with the expectation of an indicator function, can always be used in the maxent framework to get the same answer as a Bayes update on a uniform distribution.
… but uniform distributions aren’t always the right starting point, which brings us to the next key piece.
Our trick above to replicate a Bayes update using maximum entropy machinery only works insofar as the prior is uniform. And that points to a more general problem with this whole maxent approach: intuitively, it doesn’t seem like a uniform prior should always be my “assume as little as possible” starting point.
A toy example of the sort of problem which comes up: suppose two people are studying rolls of the same standard six-sided die. One of them studies extreme outcomes, and only cares whether the die rolls 6 or not, so as a preprocessing step they bin all the rolls into 6 or not-6. The other keeps the raw data on the rolls. Now, if they both use a uniform distribution, they get different distributions: one of them assigns probability ½ to a roll of 6 (because 6 is one of the two preprocessed outcomes), the other assigns probability ⅙ to a roll of 6. Seems wrong! This maxent machine should have some kind of slot in it where we put in a distribution representing (in this case) how many things we binned together already. Or, more generally, a slot where we put in prior information which we want to take as already known/given, aside from the expectation constraints.
Enter relative entropy, the negative of KL divergence.
Relative entropy can be thought of as entropy relative to a reference distribution, which works like a prior. Intuitively:
In most cases, rather than maximizing entropy, it makes more sense to maximize relative entropy - i.e. minimize KL divergence - relative to some prior . (In the case of continuous variables, using relative entropy rather than entropy is an absolute necessity, for reasons we won’t get into here.)
The upshot: if we try to mimic a Bayes update in the maxent framework just like we did earlier, but we maximize entropy relative to a prior, we get the same result as a Bayes update - without needing to assume a uniform prior. Mathematically: let
That optimization problem will spit out the standard Bayes-updated distribution
.
… and that is the last big piece in how we think of maxent machinery as a generalization of Bayes updates.
The key pieces to remember are:
… but in the cases which can be handled by Bayes’ Rule, updating via maxent yields the same answer.
You can find Jaynes’ original problem starting on page 440 of Probability Theory: The Logic Of Science. The version I present here is similar but not identical; I have modified it to remove conceptual distractions about unnormalizable priors and to get the point of this post faster.
is the indicator function; it’s 1 if its inputs are true and 0 if its inputs are false.