% This isn't even really close to working, but...

mu = .01;
rho = .01;
nexp = 5;
w = randn(2, nexp);
eta = randn(2,nexp);
h = randn(nexp, 1);

for it=1:100
	for i = 1:1000
		x = [absolute(i, 1) 1]';
		ystar = absolute(i,2);
		for e = 1:nexp
			y = w(:,e)'*x;
			w(:,e) = w(:,e) + mu*h(e)*(ystar-y)*x;
			g(e) = 0;
			hbot = 0;
			for e2 = 1:nexp
				g(e) = g(e) + exp(eta(e2)*x);
				hbot = hbot + g(e)*exp((-1/2)*(ystar-y(:,e2))^2);
			end
			g(e) = exp(eta(e)*x)/g(e);
			
			h(e) = g(e)*exp((-1/2)*(ystar-y(:,e))^2)/hbot;
			eta(e) = eta(e) + rho*(h(e)-g(e))*x;
		end
	end
end