cv.catch {catch}R Documentation

Cross-validation for CATCH


Performs k-fold cross validation for CATCH and returns the best tuning parameter λ in the user-specified or automatically generated choices.


cv.catch(x, z = NULL, y, nfolds = 5, lambda = NULL, 
lambda.opt = "min",...)



Input tensor or matrix list of length N, where N is the number of observations. Each element of the list is a tensor or matrix. The order of tensor can be any number and not limited to three.


Input covariate matrix of dimension N*q, where q<N. z can be omitted if covariate is absent.


Class label. For K class problems, y takes values in \{1,\cdots,\code{K}\}.


Number of folds. Default value is 5.


User-specified lambda sequence for cross validation. If not specified, the algorithm will generate a sequence of lambdas based on all data and cross validate on the sequence.


The optimal criteria when multiple elements in lambda return the same minimum classification error. "min" will return the smallest lambda with minimum cross validation error. "max" will return the largest lambda with the minimum cross validation error.


Other arguments that can be passed to catch.


The function cv.catch runs function catch nfolds+1 times. The first one fits model on all data. If lambda is specified, it will check if all lambda satisfies the constraints of dfmax and pmax in catch. If not, a lambda sequence will be generated according to lambda.factor in catch. Then the rest nfolds many replicates will fit model on nfolds-1 many folds data and predict on the omitted fold, repectively. Return the lambda with minimum average cross validation error and the largest lambda within one standard error of the minimum.



The actual lambda sequence used. The user specified sequence or automatically generated sequence could be truncated by constraints on dfmax and pmax.


The mean of cross validation errors for each lambda.


The standard error of cross validaiton errors for each lambda.


The lambda with minimum cross validation error. If lambda.opt is min, then returns the smallest lambda with minimum cross validation error. If lambda.opt is max, then returns the largestlambda with minimum cross validation error.


The largest lambda with cross validation error within one standard error of the minimum.

The fitted catchobj object.


Yuqing Pan, Qing Mai, Xin Zhang


Pan, Y., Mai, Q., and Zhang, X. (2018) Covariate-Adjusted Tensor Classification in High-Dimensions, arXiv:1805.04421.

See Also



n <- 20
p <- 4
k <- 2
nvars <- p*p*p
x <- array(list(),n)
vec_x <- matrix(rnorm(n*nvars), nrow=n, ncol=nvars)
vec_x[1:10,] <- vec_x[1:10,]+2
z <- matrix(rnorm(n*2),nrow=n,ncol=2)
z[1:10,] <- z[1:10,]+0.5
y <- c(rep(1,10),rep(2,10))
for (i in 1:n){
  x[[i]] <- array(vec_x[i,], dim=c(p,p,p))
objcv <- cv.catch(x, z, y=y)

[Package catch version 1.0.1 Index]