Quiz: energy and probability

Before this unit: Day 27: Graph cuts.

See also: Day 3: Bit depth and noise.

Short questions to test your understanding. Try each on paper first, then open the answer. Spins s_p = \pm 1, energy E(\mathbf s) = -J\sum_{(p,q)} s_ps_q - h\sum_p s_p, Gibbs distribution p(\mathbf s) = e^{-E(\mathbf s)/T}/Z.


Q1. Two images differ only in one pixel. The first has energy 3 units lower. At T = 1, how much more probable is it? Do you need Z?

Take the ratio of the two probabilities.

e^{3} \approx 20 times more probable. Z cancels in the ratio: only the energy difference is needed.


Q2. What happens to the Gibbs distribution as T \to 0? As T \to \infty?

Compare e^{-E/T} for two different energies when T is tiny, and when it is huge.

As T \to 0, all probability goes to the lowest-energy states (the ground states): sampling becomes energy minimisation. As T \to \infty, e^{-E/T} \to 1 for every state, so all states become equally likely and the energy no longer matters.


Q3. In a 2 \times 2 lattice with J = 1, h = 0, how many states have energy 0, and why can the level E = 0 be more probable than the level E = -4 although each of its states is less probable?

A level’s probability is (number of states) \times (probability of one state).

12 states: all except the 2 aligned states and the 2 checkerboards. The level has 12 states against 2, so at high enough T (e.g. T = 4: 0.66 against 0.30) the many slightly worse states together outweigh the two best ones.


Q4. What does a positive field h do to the two ground states “all +1” and “all -1”?

Without a field the two have the same energy.

It lowers the energy of “all +1” by nh and raises that of “all -1” by nh. Their probability ratio becomes e^{2nh/T}: the field breaks the tie, and “all +1” becomes the single most probable state. In an image model the field is the data term.


Q5. Why can we not compute the probability of one particular 256 \times 256 binary image under an Ising model?

What is needed besides e^{-E/T}?

We need Z, a sum over all 2^{65536} \approx 10^{19728} states. It cannot be computed by listing, and in 2D there is no general shortcut. Energies and ratios of probabilities are easy; absolute probabilities are not.


Q6. For pixels on a line, Z can be computed quickly. What is the trick, and which algorithm from the graph-cut day does it resemble?

Go along the line one pixel at a time.

Sum from left to right, keeping the total weight of all partial chains that end in +1 and in -1; each new pixel updates these two numbers with a 2 \times 2 table (the transfer matrix). It is dynamic programming on a chain, as in segchain, with “minimum” replaced by “sum”: n steps instead of 2^n terms.


Q7. On the graph-cut day the smoothness weight was \lambda. Which Ising parameter is it, and what plays the role of the data term?

Write s_p = 2L_p - 1.

\lambda = 2J: a disagreeing pair costs 2J more than an agreeing one. The field is the data term: D_p(1) - D_p(0) = -2h_p, with a pixel-dependent field h_p when the data differ between pixels. The minimum cut is the Ising ground state.


Q8. (math) Show that p \propto e^{-E/T} is unchanged when a constant is added to every energy.

e^{-(E + c)/T} = e^{-c/T}\,e^{-E/T}. The factor e^{-c/T} is the same for every state, so it multiplies Z too and cancels in e^{-(E + c)/T}/Z'. Only energy differences matter.