# predict.msgl: Predict In msgl: Multinomial Sparse Group Lasso

## Description

Computes the linear predictors, the estimated probabilities and the estimated classes for a new data set.

## Usage

 1 2 3 ## S3 method for class 'msgl' predict(object, x, sparse.data = is(x, "sparseMatrix"), ...) 

## Arguments

 object an object of class msgl, produced with msgl. x a data matrix of size N_\textrm{new} \times p. sparse.data if TRUE x will be treated as sparse, if x is a sparse matrix it will be treated as sparse by default. ... ignored.

 link the linear predictors – a list of length length(fit$beta) one item for each model, with each item a matrix of size K \times N_\textrm{new} containing the linear predictors. response the estimated probabilities – a list of length length(fit$beta) one item for each model, with each item a matrix of size K \times N_\textrm{new} containing the probabilities. classes the estimated classes – a matrix of size N_\textrm{new} \times d with d=length(fit$beta). ## Author(s) Martin Vincent ## Examples   1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 data(SimData) x.1 <- x[1:50,] x.2 <- x[51:100,] classes.1 <- classes[1:50] classes.2 <- classes[51:100] lambda <- msgl::lambda(x.1, classes.1, alpha = .5, d = 50, lambda.min = 0.05) fit <- msgl::fit(x.1, classes.1, alpha = .5, lambda = lambda) # Predict classes of new data set x.2 res <- predict(fit, x.2) # The error rates of the models Err(res, classes = classes.2) # The predicted classes for model 20 res$classes[,20] 

msgl documentation built on Jan. 4, 2019, 5:14 p.m.