Generative Models: Exercises

From Church Wiki
Jump to: navigation, search
To return to the top level: Probabilistic Models of Cognition.


Here are three church programs.

A) Show that the marginal distribution on return values for these three programs is the same by directly computing the probability using the rules of probability (hint: write down each possible history of random choices for each program). Check your answers by sampling from the programs.

B) Explain why these different-looking programs can give the same results.


Explain why (in terms of the evaluation process) these two programs give different answers (i.e. have different distributions on return values):


In the simple medical diagnosis example we imagined a generative process for the diseases and symptoms of a single patient. If we wanted to represent the diseases of many patients we might have tried to make each disease and symptom into a function from a person to whether they have that disease, like this: Why doesn't this work correctly if we try to do the same thing for the more complex medical diagnosis example? How could we fix it?


Work through the evaluation process for the bend higher-order function in this example: Directly compute the probability of the bent coin in the example. Check your answer by comparing to the histogram of many samples.


Here are four expressions you could evaluate using the model (the set of definitions) from the tug-of-war example:

A) Write down the sequence of expression evaluations and random choices that will be made in evaluating each expression.

B) Directly compute the probability for each possible return value from each expression.

C) Why are the probabilities different for the last two? Explain both in terms of the probability calculations you did and in terms of the “causal” process of evaluating and making random choices.


Convert the following probability table to a compact Church program:

A B P(A,B)
F F 0.14
F T 0.06
T F 0.4
T T 0.4

Hint: fix the probability of A and then define the probability of B to depend on whether A is true or not. Run your Church program using cosh to check that you get the correct distribution

Personal tools