jacaTrain: Solve Joint Association and Classification Analysis problem...

Description Usage Arguments Value Examples

View source: R/JACA_mian_functions.R

Description

Given Class indicator matrix Z and a list of matrices X_list, jacaTrain estimates view-specific matrices of discriminant vectors by solving Joint Association and Classification Analysis problem. It can also be used to perform semi-supervised learning, that is to use information from both labeled and unlabeled subjects to construct classification rules.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
jacaTrain(
  Z,
  X_list,
  lambda,
  rho,
  missing = F,
  alpha = 0.5,
  W_list = NULL,
  kmax = 500,
  eps = 1e-06,
  verbose = F
)

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.

lambda

A vector of L1 penalty parameters; if there are D input data matrices, lambda should also contain D elements. lambda controls the sparsity of the solutions and must be between 0 and 1 (small L1 bound corresponds to less penalization).

rho

Scaler, l2 regularization penulty parameter on X'X/n. Should also be between 0 and 1 (small L2 bound corresponds to less penalization).

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

The parameter to control the weight between optimal scoring and CCA part. Default is 0.5.

W_list

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

kmax

Max iteration number.

eps

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

Value

W_d

A list of view-specific matrices of discriminant vectors.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
set.seed(1)
# Generate class indicator matrix Z
n = 100
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
X_list = sapply(1:d, function(i) list(matrix(rnorm(n * 20), n, 20)))

# Train JACA model
W = jacaTrain(Z, X_list, lambda = rep(0.05, 2), verbose = FALSE, alpha= 0.5, rho = 0.2)

# Show the number of non-zero rows of each matrix of discriminant vectors
sapply(W, function(x) sum(rowSums(x) != 0))

# Test semi supervised learning
# Set certain class labels and subsets of views as missing
Z[90:100, ] = rep(NA, 3)
X_list[[1]][1:10, ] = NA
X_list[[2]][11:20, ] = NA
W = jacaTrain(Z, X_list, kmax = 200, eps = 1e-06, lambda = rep(0.05, 2),
              alpha = 0.5, rho = 0.2, missing = TRUE)

# Show the number of non-zero rows of each matrix of discriminant vectors
sapply(W, function(x) sum(rowSums(x) != 0))

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