
%%%%%%%%%%

function plot_mixexp2(theta, eta, data)

xrange = -1:0.02:1;
numexp = size(theta, 1);
mn = min(data);
mx = max(data);
xa = mn(1):0.01:mx(1);
x = [ones(length(xa),1) xa'];
% pr(i,l) = posterior probability of expert i on example l
pr = exp(eta * x');
pr = pr ./ (ones(numexp,1) * sum(pr));
% y(i,l) = prediction of expert i for example l
y = theta * x';
% yg(l) = weighted prediction  for example l
yg = sum(y .* pr)';

hold on
plot(data(:,1), data(:,2), '+');
hold off
