solve_DAP_seq {DAP} | R Documentation |
Uses block-coordinate descent algorithm with warm initializations, starts with the maximal supplied lambda value.
solve_DAP_seq(X1, X2, lambda_seq, eps = 1e-04, maxiter = 10000, feature_max = nrow(X1) + nrow(X2))
X1 |
A n1 x p matrix of group 1 data (scaled). |
X2 |
A n2 x p matrix of group 2 data (scaled). |
lambda_seq |
A supplied sequence of tunning parameters. |
eps |
Convergence threshold for the block-coordinate decent algorithm based on the maximum element-wise change in V. The default is 1e-4. |
maxiter |
Maximum number of iterations, the default is 10000. |
feature_max |
An upper bound on the number of nonzero features in the solution; the default value is the total sample size. The algorithm trims the supplied |
A list of
lambda_seq |
A sequence of considered lambda values. |
V1_mat |
A p x m matrix with columns corresponding to the 1st projection vector V1 found at each lambda from |
V2_mat |
A p x m matrix with columns corresponding to the 2nd projection vector V2 found at each lambda from |
nfeature_vec |
A sequence of corresponding number of selected features for each value in |
## This is an example for solve_DAP_seq ## Generate data n_train = 50 n_test = 50 p = 100 mu1 = rep(0, p) mu2 = rep(3, p) Sigma1 = diag(p) Sigma2 = 0.5* diag(p) ## Build training data x1 = MASS::mvrnorm(n = n_train, mu = mu1, Sigma = Sigma1) x2 = MASS::mvrnorm(n = n_train, mu = mu2, Sigma = Sigma2) xtrain = rbind(x1, x2) ytrain = c(rep(1, n_train), rep(2, n_train)) ## Standardize the data out_s = standardizeData(xtrain, ytrain, center = FALSE) ####use solve_proj_seq fit = solve_DAP_seq(X1 = out_s$X1, X2 = out_s$X2, lambda_seq = c(0.2, 0.3, 0.5, 0.7, 0.9))