Learn R Programming

picasso (version 2.0.1)

multinomial-methods: Methods for Multinomial picasso Fits

Description

Fit multinomial models with picasso using family = "multinomial", then print, plot, extract coefficients, or predict from the fitted class-coupled regularization path.

Usage

# S3 method for multinomial
print(x, ...)

# S3 method for multinomial plot(x, which.class = 1, ...)

# S3 method for multinomial coef(object, lambda.idx = NULL, beta.idx = NULL, ...)

# S3 method for multinomial predict(object, newdata, lambda.idx = NULL, type = "response", s = NULL, ...)

Value

print.multinomial returns x invisibly. plot.multinomial draws one class's coefficient paths and returns NULL invisibly.

coef.multinomial returns a list of \(K\) numeric matrices, one per class. Rows contain the intercept followed by selected coefficients, and columns correspond to selected lambdas.

For one selected lambda, predict.multinomial returns an \(n_{\mathrm{new}} \times K\) matrix for "response" or "link", a factor of length \(n_{\mathrm{new}}\) for "class", or a list of \(K\) integer vectors for "nonzero". Multiple lambda.idx or s values return a list of those objects.

The fitted object returned by picasso contains class-specific beta and intercept lists, lambda, df, levels, K, dev.ratio, status/failure metadata, per-lambda diagnostics, path.early.stopped, and requested.nlambda; see picasso.

Arguments

x

A fitted object with S3 class "multinomial".

object

A fitted object with S3 class "multinomial".

which.class

One-based class index whose coefficient path is plotted. The default is 1.

lambda.idx

One-based lambda indices for extraction or prediction. If NULL, the first three available lambdas (or the entire path when shorter) are used. Supply only one of lambda.idx and s.

beta.idx

One-based feature indices to extract. If NULL, the first three available features are used.

newdata

Finite numeric matrix of new observations with the same number of columns as the fitted design.

type

Prediction type. "response" returns softmax probabilities, "link" returns class-specific linear predictors, "class" returns the fitted label with the largest finite link-scale score (first fitted class on an exact tie), and "nonzero" returns nonzero feature indices separately by class.

s

Optional finite non-negative lambda values. Coefficients are linearly interpolated between fitted lambdas for response, link, and class predictions; values outside the path are clamped to an endpoint. type = "nonzero" uses the nearest fitted lambda instead.

...

Additional arguments (currently unused).

Author

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

Details

The public fitting call is picasso(X, Y, family = "multinomial", ...). Responses must contain at least three observed classes; numeric, character, and factor labels are accepted, and unused factor levels are dropped.

The solver first identifies a strong working set and then solves the class-coupled restricted problem with Proximal Newton/IRLS iterations until the weighted-L1 subproblem converges. Full KKT checks update the active set and certify every retained subproblem. Pathwise warm starts, sequential strong screening, adaptive inexact Newton tolerances, vectorized coordinate kernels, and accepted-probability reuse reduce repeated work.

MCP and SCAD use adaptive local linear approximation. Every fit performs the minimum three total stages (one L1 master and two weighted-L1 updates). Raising lla.max.stages permits further stages, which stop once target stationarity is at most prec; exhausting the budget yields the usable status lla_stationarity_limit.

After at least five lambdas, an automatically generated path stops normally when explained deviance exceeds 0.999 or its improvement is below 1e-5. Explicit lambda sequences disable only this saturation rule; dfmax or a hard failure can still truncate them. A hard failure after one or more completed lambdas returns the committed prefix with a warning and failure metadata; failure before the first completed lambda is an error.

With no intercept, standardized predictors are scaled about the origin rather than centered. The zero model then uses uniform class probabilities for the automatic lambda path and null deviance.

See Also

picasso, cv.picasso, and assess.picasso.

Examples

Run this code
set.seed(1)
n <- 120; d <- 12
X <- matrix(rnorm(n * d), n, d)
score <- cbind(X[, 1], -X[, 1] + X[, 2], -X[, 2])
Y <- factor(c("red", "green", "blue")[max.col(score)])
fit <- picasso(X, Y, family = "multinomial", nlambda = 12)
prob <- predict(fit, X[1:5, ], lambda.idx = fit$nlambda,
                type = "response")
pred <- predict(fit, X[1:5, ], lambda.idx = fit$nlambda,
                type = "class")

Run the code above in your browser using DataLab