randn('state',0);
rand('state',0);
a = 1;
b = -5 ;
m= 100;
u = 10*rand(m,1);
y = (rand(m,1) < exp(a*u+b)./(1+exp(a*u+b)));
plot(u,y,'o')
axis([-1,11,-0.1, 1.1]);
U = [ones(m,1) u];
cvx_expert true
cvx_begin
variables x(2)
maximize(y'*U*x-sum(log_sum_exp([zeros(1,m); x'*U'])))
cvx_end
ind1 = find(y==1);
ind2 = find(y==0);
aml = x(2); bml = x(1);
us = linspace(-1,11,1000)';
ps = exp(aml*us + bml)./(1+exp(aml*us+bml));
dots = plot(us,ps,'-', u(ind1),y(ind1),'o',...
u(ind2),y(ind2),'o');
axis([-1, 11,-0.1,1.1]);
xlabel('x');
ylabel('y');
Successive approximation method to be employed.
SDPT3 will be called several times to refine the solution.
Original size: 602 variables, 400 equality constraints
200 exponentials add 1600 variables, 1000 equality constraints
-----------------------------------------------------------------
Cones | Errors |
Mov/Act | Centering Exp cone Poly cone | Status
--------+---------------------------------+---------
200/200 | 5.422e+00 2.242e+00 0.000e+00 | Solved
200/200 | 5.049e-01 1.636e-02 0.000e+00 | Solved
194/199 | 2.442e-02 3.880e-05 0.000e+00 | Solved
0/148 | 3.819e-04 7.845e-09 0.000e+00 | Solved
-----------------------------------------------------------------
Status: Solved
Optimal value (cvx_optval): -32.9797