The PROB-code snippet from Gordon et al. is translated by us to a functional CHURCH program to clarify its semantics. The generative model is contained in the CHURCH function "take-a-sample". The direction of inference in the conditional P(G | L=1) = P(Grade | weak_letter) is inverse to the direction of CPDs in the generative Bayesian network.
Here is a summary of the domains due to the modifications of Gordon et al. (2014):
Val(D) = <d0, d1> = <easy, hard>
Val(I) = <i0, i1> = <non smart, smart>
Val(G) = <g0, g1> = <A, B+C> = <excellent, good+average>
Val(S) = <s0, s1> = <low score, high score>
Val(L) = <l0, l1> = <strong_letter, weak_letter>
The number of samples was set to 20000 in this run. This number could in principle be increased to get a better precision of estimates. The value of the variable math_expect (= parameter theta in the HOEFFDING inequality) was computed by the exact 'variable-elimination' inference method in the probabilistic programming language FIGARO. The sampling method used in our CHURCH-program is the simple-to-understand 'forward sampling'. The screen-shot presented was generated by using the PlaySpace environment of WebCHURCH.
The inferred E(G | L=1) = P(G=1 | L=1) is near 0.91 and much higher than in the reverse direction, so the verbal interpretation is "If you have a weak recommendation letter, then a nonexcellent grade is pretty certain".