Description Usage Arguments Value Examples
View source: R/JACA_mian_functions.R
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).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
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 |
n_lambda |
The number of |
rho_seq |
The set of L2 penalty parameters to be considered. Should be chosen from 0 to 1. |
n_rho |
The number of |
missing |
Logical. If False, input data |
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 |
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. |
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))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.