Learn R Programming

picasso (version 2.0.1)

assess.picasso: Model Assessment for picasso Fits

Description

Compute prediction-quality metrics across the regularization path. assess.picasso evaluates deviance, MSE, MAE, or classification error on a test set; confusion.picasso returns confusion matrices for binary and multinomial classification. For scalar families, large lambda paths are evaluated in bounded link-predictor blocks; small paths still use one matrix multiplication.

Usage

assess.picasso(object, newx, newy, newoffset = NULL, ...)

# S3 method for assess.picasso print(x, ...)

confusion.picasso(object, newx, newy, lambda.idx = NULL, newoffset = NULL, ...)

Value

assess.picasso returns an object of class "assess.picasso"

containing named numeric vectors (one value per lambda):

lambda

Lambda values.

deviance

Family-specific test loss: half mean squared error for Gaussian and square-root-lasso, Bernoulli or multinomial negative log-likelihood for categorical models, and conventional mean Poisson deviance for Poisson.

mse

Mean squared error (Gaussian, square-root-lasso, or Poisson).

mae

Mean absolute error (Gaussian or square-root-lasso).

class

Misclassification rate (binomial or multinomial).

confusion.picasso returns a list of table objects, one per selected lambda value, with predicted classes in rows and observed classes in columns. Multinomial tables retain all fitted class levels on both axes, including levels absent from the supplied test subset; binomial tables always retain levels 0 and 1.

print.assess.picasso prints the range of each metric across the fitted path and returns its input invisibly.

Scalar-family assessment targets about 8 MiB for each link-predictor and coefficient block, subject to a minimum of one lambda column. Metric calculation may use additional arrays of the same bounded block shape. This changes only working-memory use, not the returned metrics or their ordering.

Arguments

object

A fitted picasso object with a $family field.

newx

Numeric design matrix for the test set, \(n \times d\).

newy

Test-set response vector. Binomial and multinomial values must match class labels seen during fitting. Numeric zero/one remains accepted as an encoded binomial response; legacy fits without a stored class map require that encoding.

lambda.idx

Integer vector of lambda indices for which to compute confusion matrices. Defaults to all lambdas.

newoffset

Optional finite numeric vector with one offset per row of newx. It is required for binomial or Poisson assessment, and for binomial confusion matrices, when the model was fitted with an offset.

x

An "assess.picasso" object.

...

Currently unused.

Author

Jason Ge, Xingguo Li, Haoming Jiang, Mengdi Wang, Tong Zhang, Han Liu and Tuo Zhao
Maintainer: Tuo Zhao <tourzhao@gatech.edu>

See Also

picasso, cv.picasso

Examples

Run this code
set.seed(1)
n <- 100; d <- 30
X <- matrix(rnorm(n * d), n, d)
Y <- rbinom(n, 1, 0.5)
fit <- picasso(X, Y, family = "binomial", nlambda = 20)
a <- assess.picasso(fit, X, Y)
print(a)

Run the code above in your browser using DataLab