Академический Документы
Профессиональный Документы
Культура Документы
3. Write a loop to keep updating your posterior over b based on the data. Keep
track of the posterior in a matrix P, where P(:,t) is the distribution on trial t. Dont
forget to keep normalizing the posterior when you update!
Plot the result in two ways. First, plot the posterior for each time point as a line
plot on the same axes (plot(b, P) in matlab). Second, plot the posterior as a heat
plot using the imagesc function (imagesc(P)). What does this tell you about the
accuracy of the estimate of the bias over time?
4. Compute the mean of the posterior over time. Remember that the mean of a
probability distribution is
(t)= db p ( bd 1 :t ) b b ( i ) pBD ( i , t )
i
6. Now loop over all trials to compute how the posterior changes over time. Plot
the result using imagesc. Plot the true bias on the same plot using the plot
function and hold on.
7. Compute and plot the mean of the bias over time. Does this remind you of
anything? Cast your mind back to Assignment 4 again and the finite learning rate
models
8. Suppose that you did not know the slot machine could change its bias i.e.
suppose you tried to infer the bias using the model in Question 1. Compute what
would happen and plot the resulting posterior over time using imagesc.
Extra Credit (5%)
Suppose that instead of the slot machine changing its bias abruptly on some
trials, the slot machine changes its bias gradually on all trials.
In particular, lets assume that the transition probability p(b t | bt-1) is given by
p ( bt|bt 1 ) b tX ( 1bt )Y
where X and Y are related to bt-1
X =40 bt 1
Y =40(1bt1 )
Simulate how bt evolves over time with this transition structure. And the simulate
how Bayes rule can infer how the bias changes over time.