**This is an old revision of the document!**

This assignment is designed to:

- give you practice thinking about probabilistic models in the form of Bayes Nets (directed graphical models)
- help you become more fluent with the terminology and the techniques of the course
- prepare you to work with interesting graphical models of natural phenomena!

Show your work. Be clear and concise. **This assignment must be typed.**

- [10 points] Prove that the relationship we call
*conditional independence*is symmetric. In other words, Prove either (a) or (b) (since they are equivalent), and apply the same standard of proof as in assignment 1:- (a) $P(X | Y, Z) = P(X | Z)$ if and only if $P(Y | X, Z) = P(Y | Z)$
- (b) $P(X, Y | Z) = P(X | Z) \cdot P(Y|Z)$ if and only if $P(Y, X | Z) = P(Y | Z) \cdot P(X | Z)$
- (in other words, the “given $Z$” stays the same, while $X$ and $Y$ trade places).

- [20 points: 10 points each] (based on exercise 2.2 in Koller and Friedman) Independence:
- Prove that for binary random variables $X$ and $Y$, the event-level independence $(x^0 \bot y^0)$ implies random-variable independence $(X \bot Y)$. Use the usual standard of proof.
- Give a counterexample for nonbinary variables.

- [20 points] Consider how to sample from a categorical distribution over four colors. Think of a spinner with four regions having probabilities $p_{red}$, $p_{green}$, $p_{yellow}$, and $p_{blue}$. Write pseudo-code for choosing a sample from this distribution.
- [10 points] Does your pseudo-code scale to a distribution over ten thousand values? If not, rewrite it. If so, say why.
- [20 points] Implement your pseudo-code, run it 100 times, and give the results as a vector of counts over the four colors.
- [10 points] Normalize your count vector by 100. How does the result compare with your chosen parameters?
- [10 points] Compute the mean and variance of the estimated multinomial distribution you just discovered.

Your **typed** report should include:

- Your work and solutions for the exercises

Organize your report and use clear headings and explanations where needed.

Submit a .pdf document through Learning Suite.