dLDA {MGSDA} | R Documentation |
Solve Multi-Group Sparse Discriminant Anlalysis problem for the supplied value of the tuning parameter lambda.
dLDA(xtrain, ytrain, lambda, Vinit = NULL,eps=1e-6,maxiter=1000,rho=1)
xtrain |
A Nxp data matrix; N observations on the rows and p features on the columns. |
ytrain |
A N-vector containing the group labels. Should be coded as 1,2,...,G, where G is the number of groups. |
lambda |
Tuning parameter. |
Vinit |
A px(G-1) optional initial value for the optimization algorithm; the default value is NULL. |
eps |
Tolerance level for the convergence of the optimization algorithm; the default value is 1e-6. |
maxiter |
Maximal number of iterations for the optimization algorithm; the default value is 1000. |
rho |
A scalar that ensures the objective function is bounded from below; the default value is 1. |
Solves the following optimization problem:
min_V {1/2*Tr(V'WV+rho*V'DD'V-2D'V)+lambda*sum(||v_i||_2)}.
Here W is the within-group sample covariance matrix and D is the matrix of orthogonal contrasts between the group means, both are constructed based on the supplied values of xtrain
and ytrain
.
When G=2, the row penalty reduces to vector L_1 penalty.
Returns a px(G-1) matrix of canonical vectors V.
Irina Gaynanova
I.Gaynanova, J.Booth and M.Wells (2015) "Simultaneous Sparse Estimation of Canonical Vectors in the p>>N setting", JASA, to appear
# Example 1 n=10 p=100 G=3 ytrain=rep(1:G,each=n) set.seed(1) xtrain=matrix(rnorm(p*n*G),n*G,p) V=dLDA(xtrain,ytrain,lambda=0.1) sum(rowSums(V)!=0) # number of non-zero rows