cv.catch {catch} | R Documentation |
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",...)
x |
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. |
z |
Input covariate matrix of dimension N*q, where q<N. |
y |
Class label. For |
nfolds |
Number of folds. Default value is |
lambda |
User-specified |
lambda.opt |
The optimal criteria when multiple elements in |
... |
Other arguments that can be passed to |
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.
lambda |
The actual |
cvm |
The mean of cross validation errors for each |
cvsd |
The standard error of cross validaiton errors for each |
lambda.min |
The |
lambda.1se |
The largest |
catch.fit |
The fitted |
Yuqing Pan, Qing Mai, Xin Zhang
Pan, Y., Mai, Q., and Zhang, X. (2018) Covariate-Adjusted Tensor Classification in High-Dimensions, arXiv:1805.04421.
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)