This shows you the differences between two versions of the page.

Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||

cs-401r:assignment-2 [2014/09/16 11:51] cs401rpml [Exercises] |
cs-401r:assignment-2 [2014/09/17 22:34] ringger [Exercises] |
||
---|---|---|---|

Line 20: | Line 20: | ||

#* Give a counterexample for nonbinary variables. | #* 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. | # [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. | ||

+ | #* You may assume that you have access to a function that samples a uniform random variable with support [0,1]. | ||

# [10 points] Does your pseudo-code scale to run efficiently on a distribution over ten thousand values? If not, rewrite it. If so, say why. | # [10 points] Does your pseudo-code scale to run efficiently on a distribution over ten thousand values? If not, rewrite it. If so, say why. | ||

# [20 points] Implement your pseudo-code, choose values for the four probabilities on the spinner as parameters to your procedure, and run it 100 times, keeping track of how many times each color shows up. Give the results as a vector of counts over the four colors. | # [20 points] Implement your pseudo-code, choose values for the four probabilities on the spinner as parameters to your procedure, and run it 100 times, keeping track of how many times each color shows up. 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] 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 from your experiment. | + | |

== Report == | == Report == |