catch_matrix {catch}R Documentation

Fit a CATCH model for matrix and predict categorical response.

Description

Fits a classifier for matrix data. catch_matrix is a special case of catch when each observation \mathbf{X}_i is a matrix. Different from catch takes list as input, data need to be formed in an array to call the function (see arguments). The function will perform prediction as well.

Usage

catch_matrix(x, z = NULL, y, testx = NULL, testz = NULL, ...)

Arguments

x

Input matrix array. The array should be organized with dimension p1*p2*N, where \eqn{N} is the number of observations.

z

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

y

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

testx

Input testing matrix array. When testx is not provided, the function will only fit model. When testx is provided, the function will predict response on testx as well.

testz

Input testing covariate matrix. Can be omitted if there is no covariate.

...

Other arguments that can be passed to catch.

Details

The function fits a matrix classifier as a special case of catch. The fitted model and predictions should be identical to catch when matrix data is provided. Input matrix should be organized as three-way array where sample size is the last dimension. If the matrix is organized in a list, users can either reorganize it or use catch directly to fit model, which takes a matrix or tensor list as input and has the same output as catch_matrix.

Value

beta

Output variable coefficients for each lambda. beta is a list of length being the number of lambdas. Each element of beta is a matrix of dimension (p_1\times p_2)*(nclass-1).

df

The number of nonzero variables for each value in sequence lambda.

dim

Dimension of coefficient array.

lambda

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

obj

Objective function value for each value in sequence lambda.

x

The matrix list after adjustment in training data. If covariate is absent, this is the original input matrix.

y

Class label in training data.

npasses

Total number of iterations.

jerr

Error flag.

sigma

Estimated covariance matrix on each mode. sigma is a list with the ith element being covariance matrix on ith mode.

delta

Estimated delta matrix (vec(\widehat{\boldsymbol{μ}}_2-\widehat{\boldsymbol{μ}}_1),\cdots,vec(\widehat{\boldsymbol{μ}}_K-\widehat{\boldsymbol{μ}}_1)).

mu

Estimated mean array.

prior

Prior proportion of observations in each class.

call

The call that produces this object.

pred

Predicted categorical response for each value in sequence lambda when testx is provided.

Author(s)

Yuqing Pan, Qing Mai, Xin Zhang

References

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

See Also

catch

Examples

#without prediction
n <- 20
p <- 4
k <- 2
nvars <- p*p
x=array(rnorm(n*nvars),dim=c(p,p,n))
x[,,11:20]=x[,,11:20]+0.3
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))
obj <- catch_matrix(x,z,y=y)

[Package catch version 1.0.1 Index]