Learn R Programming

DAP (version 1.0)

solve_DAP_seq: Solves DAP optimization problem for a given sequence of lambda values

Description

Uses block-coordinate descent algorithm with warm initializations, starts with the maximal supplied lambda value.

Usage

solve_DAP_seq(X1, X2, lambda_seq, eps = 1e-04, maxiter = 10000,
  feature_max = nrow(X1) + nrow(X2))

Arguments

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 lambda_seq to eliminate solutions that exceed feature_max.

Value

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 lambda_seq.

V2_mat

A p x m matrix with columns corresponding to the 2nd projection vector V2 found at each lambda from lambda_seq.

nfeature_vec

A sequence of corresponding number of selected features for each value in lambda_seq.

Examples

Run this code
# NOT RUN {
## 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))
# }

Run the code above in your browser using DataLab