I am trying to implement Sparse PCA as described in 6 of http://www.eecs.berkeley.edu/~elghaoui/Pubs/SPCAhandbookSV.pdf
this is my code:
X = randn(20,20);
R = X’*X;
d = 20;
e = ones(d,1);
lambda = 0.5;
mu = 1e-4;
opts = [];
opts.stopCrit = 4;
opts.printEvery = 1;
opts.tol = 1e-4;
opts.maxIts = 25;
%opts.errFcn{1} = @(f,d,p) norm(p{1}+p{2}-X,‘fro’)/norm(X,‘fro’);
largescale = true;
x0 = {e*e’};
z0 = [];
obj={proj_psdUTrace(1)};
affine = { -R 0;1 0};
dualProx = {proj_spectral,proj_linf(lambda)} ;
[x,out,optsOut] = tfocs_SCD( obj, affine, dualProx, mu, x0, z0, opts);
Y=x{1};
however this is not working correctly(err like matrix dimension not agree)… Plz tell me where I am wrong…
In particular, can any body help me to tell what should be obj, affine and dualProx for this problem…?
In particular how can we solve this problem for large sized matrices in tfocs, cvx code for the problem is as follows:
variable X(d,d) symmetric;
X == semidenite(d);
minimize(-trace(RX)+lambda(e’*abs(X)*e));
subject to
trace(X)==1;
cvx end