jacaCVerror: Alternative cross-validation function for JACA tailored...

Description Usage Arguments Value Examples

View source: R/JACA_mian_functions.R

Description

Chooses optimal tuning parameters lambda, rho and alpha for function jacaTrain based on cross-validation to minimize out-of-sample misclassifiation error rate (measured by objective function in JACA with alpha = 1).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
jacaCVerror(
  Z,
  X_list,
  nfolds = 5,
  lambda_seq = NULL,
  n_lambda = 50,
  rho_seq = seq(0.01, 1, length = 5),
  n_rho = 5,
  missing = F,
  alpha_seq = c(0.5, 0.7),
  W_list = NULL,
  kmax = 500,
  eps = 1e-06,
  verbose = F,
  foldID = NULL
)

Arguments

Z

An N by K class indicator matrix; rows are samples and columns are class indicator vectors with z_k = 1 if observation belongs to class k.

X_list

A list of input data matrices; in each sublist, rows are samples and columns are features.

nfolds

Number of cross-validation folds.

lambda_seq

The set of L1 penalty parameters to be considered. Should be chosen from 0 to 1. The default value is NULL and jacaCV generates its own sequence.

n_lambda

The number of lambda_seq considered. Used only if lambda_seq = NULL.

rho_seq

The set of L2 penalty parameters to be considered. Should be chosen from 0 to 1.

n_rho

The number of rho_seq considered. Used only if rho_seq = NULL.

missing

Logical. If False, input data X_list must be complete and have no missing values. If True, input data X_list should contain missing values.

alpha_seq

A sequence of alpha values to consider, where alpha must be strictly greater than 0, and less or equal to 1.

W_list

A list of inital guess of matrices of discriminant vectors (can be served as a warm start).

kmax

Max iteration number.

eps

Threshold value used to determine the convergence of the optimization algorithm; the default value is 1e-06.

verbose

Logical. If False, the algorithm will stay silent. If True, it will print out fitting progress.

foldID

User-supplied fold seperation. The default is NULL, and jacaCV generates its own folds.

Value

W_min

A list of view-specific matrices of discriminant vectors. Generated using the parameters chosen by cross-validation method.

lambda_min

The value of L1 penalty parameter that resulted in the minimal mean cross-validation error.

rho_min

The value of L2 penalty parameter that resulted in the minimal mean cross-validation error.

alpha_min

The value of alpha parameter that resulted in the minimal mean cross-validation error.

grid_seq

The matrix of tuning parameters used.

error_mean

The mean cross-validated error of each combination of the tuning parameters.

error_se

The standard error of cross-validated error of each combination of the tuning parameters.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
#' set.seed(1)
# Generate class indicator matrix Z
n = 20
Z=matrix(c(rep(1, n),rep(0, 2 * n)), byrow = FALSE, nrow = n)
for(i in 1:n){
  Z[i, ] = sample(Z[i, ])
}

# Generate input data X_list
d = 2; p=10
X_list = sapply(1:d, function(i) list(matrix(rnorm(n * p), n, p)))

# Train JACA model using cross validation to minimize the error rate
result = jacaCVerror(Z, X_list, nfolds = 3, lambda_seq = c(0.02, 0.04), rho_seq = c(0.3, 0.6))

Pennisetum/JACA documentation built on April 30, 2021, 12:30 a.m.