EXERCISES 18
PROBABILISTIC PROGRAMMING
18.1 Relational Probability Models
Exercise [Link]
Three soccer teams A, B, and C, play each other once. Each match is between two teams,
and can be won, drawn, or lost. Each team has a fixed, unknown degree of quality—an integer
ranging from 0 to 3—and the outcome of a match depends probabilistically on the difference
in quality between the two teams.
a. Construct a relational probability model to describe this domain, and suggest numerical
values for all the necessary probability distributions.
b. Construct the equivalent Bayesian network for the three matches.
c. Suppose that in the first two matches A beats B and draws with C. Using an exact
inference algorithm of your choice, compute the posterior distribution for the outcome
of the third match.
d. Suppose there are n teams in the league and we have the results for all but the last
match. How does the complexity of predicting the last game vary with n?
e. Investigate the application of MCMC to this problem. How quickly does it converge in
practice and how well does it scale?
a. The classes are T eam, with instances A, B, and C, and M atch, with instances AB,
BC, and CA. Each team has a quality Q and each match has a T eam1 and T eam2 and
an Outcome. The team names for each match are of course fixed in advance. The prior
over quality could be uniform and the probability of a win for team 1 should increase with
Q(T eam1) − Q(T eam2).
b. The random variables are A.Q, B.Q, C.Q, [Link], [Link], and
[Link]. The network is shown in Figure S18.1.
c. The exact result will depend on the probabilities used in the model. With any prior on
quality that is the same across all teams, we expect that the posterior over [Link]
will show that C is more likely to win than B.
d. The inference cost in such a model will be O(2n) because all the team qualities become
coupled.
e. MCMC appears to do well on this problem, provided the probabilities are not too
skewed. Our results show scaling behavior that is roughly linear in the number of
teams, although we did not investigate very large n.
Exercises 18 Probabilistic Programming
A.Q B.Q C.Q
[Link] [Link] [Link]
Figure S18.1 Bayes net showing the dependency structure for the team quality and game
outcome variables in the soccer model.
[[need exercises]]
Section 18.2 Open-Universe Probability Models
18.2 Open-Universe Probability Models
[[need exercises]]
18.3 Keeping Track of a Complex World
[[need exercises]]
18.4 Programs as Probability Models
[[need exercises]]