| Title: | Sparse Learning with Convex and Concave Penalties |
|---|---|
| Description: | Fast regularization paths for sparse Gaussian, binomial, Poisson, square-root-lasso, and multinomial models with lasso, smoothly clipped absolute deviation, or minimax concave penalties. Computation uses pathwise coordinate optimization, active-set updates, warm starts, screening rules, Proximal Newton iterations, quadratic majorization, and adaptive local linear approximation where appropriate. Core solvers are implemented in C++, and coefficient paths are returned as Matrix-compatible objects. |
| Authors: | Jason Ge [aut], Xingguo Li [aut], Haoming Jiang [aut], Mengdi Wang [aut], Tong Zhang [aut], Han Liu [aut], Tuo Zhao [aut, cre], Gael Guennebaud [ctb] (Contributor to bundled Eigen headers), Benoit Jacob [ctb] (Contributor to bundled Eigen headers), Eigen Library Authors [cph] (Copyright holders of bundled Eigen headers in src/include/eigen3) |
| Maintainer: | Tuo Zhao <[email protected]> |
| License: | GPL-3 |
| Version: | 2.0.1 |
| Built: | 2026-09-23 11:15:08 UTC |
| Source: | https://github.com/cran/picasso |
Computationally efficient tools for fitting sparse generalized linear models with convex or non-convex penalties. Supported penalties include lasso, smoothly clipped absolute deviation (SCAD), and minimax concave penalty (MCP). Supported families are Gaussian, binomial, Poisson, square-root-lasso, and multinomial. Computation combines pathwise coordinate optimization with warm starts, active-set updates, screening rules, Proximal Newton iterations, and adaptive local linear approximation for applicable nonconvex models.
Core optimization routines are implemented in C++. Gaussian models use active-set coordinate descent with an automatic residual/covariance backend; binomial and Poisson models use active-set Proximal Newton/IRLS, square-root-lasso uses a global quadratic majorizer with active-set coordinate updates, and multinomial uses class-coupled Proximal Newton/IRLS. The R interface returns coefficient paths as Matrix objects and provides prediction, assessment, confusion-matrix, and cross-validation helpers.
Jason Ge, Xingguo Li, Haoming Jiang, Mengdi Wang, Tong Zhang, Han Liu and Tuo Zhao
Maintainer: Tuo Zhao <[email protected]>
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.
assess.picasso(object, newx, newy, newoffset = NULL, ...) ## S3 method for class 'assess.picasso' print(x, ...) confusion.picasso(object, newx, newy, lambda.idx = NULL, newoffset = NULL, ...)assess.picasso(object, newx, newy, newoffset = NULL, ...) ## S3 method for class 'assess.picasso' print(x, ...) confusion.picasso(object, newx, newy, lambda.idx = NULL, newoffset = NULL, ...)
object |
A fitted |
newx |
Numeric design matrix for the test set, |
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
|
x |
An |
... |
Currently unused. |
assess.picasso returns an object of class "assess.picasso"
containing named numeric vectors (one value per lambda):
Lambda values.
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.
Mean squared error (Gaussian, square-root-lasso, or Poisson).
Mean absolute error (Gaussian or square-root-lasso).
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.
Jason Ge, Xingguo Li, Haoming Jiang, Mengdi Wang, Tong Zhang, Han Liu and Tuo Zhao
Maintainer: Tuo Zhao <[email protected]>
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)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)
"gaussian"
Extract estimated coefficient vectors from selected points on the regularization path.
## S3 method for class 'gaussian' coef(object, lambda.idx = NULL, beta.idx = NULL, ...)## S3 method for class 'gaussian' coef(object, lambda.idx = NULL, beta.idx = NULL, ...)
object |
An object with S3 class |
lambda.idx |
Indices of regularization parameters in the solution path to extract. By default, at most the first three fitted path points are used. |
beta.idx |
Indices of coefficient entries to extract. By default, at most the first three coefficients are used. |
... |
Arguments to be passed to methods. |
A numeric matrix of extracted coefficients.
Columns correspond to lambda.idx. Rows contain the intercept
("(Intercept)") and the selected coefficients
("beta[i]" for i in beta.idx).
Jason Ge, Xingguo Li, Haoming Jiang, Mengdi Wang, Tong Zhang, Han Liu and Tuo Zhao
Maintainer: Tuo Zhao <[email protected]>
picasso and picasso-package.
"logit"
Extract estimated coefficient vectors from selected points on the regularization path.
## S3 method for class 'logit' coef(object, lambda.idx = NULL, beta.idx = NULL, ...)## S3 method for class 'logit' coef(object, lambda.idx = NULL, beta.idx = NULL, ...)
object |
An object with S3 class |
lambda.idx |
Indices of regularization parameters in the solution path to extract. By default, at most the first three fitted path points are used. |
beta.idx |
Indices of coefficient entries to extract. By default, at most the first three coefficients are used. |
... |
Arguments to be passed to methods. |
A numeric matrix of extracted coefficients.
Columns correspond to lambda.idx. Rows contain the intercept
("(Intercept)") and the selected coefficients
("beta[i]" for i in beta.idx).
Jason Ge, Xingguo Li, Haoming Jiang, Mengdi Wang, Tong Zhang, Han Liu and Tuo Zhao
Maintainer: Tuo Zhao <[email protected]>
picasso and picasso-package.
"poisson"
Extract estimated coefficient vectors from selected points on the regularization path.
## S3 method for class 'poisson' coef(object, lambda.idx = NULL, beta.idx = NULL, ...)## S3 method for class 'poisson' coef(object, lambda.idx = NULL, beta.idx = NULL, ...)
object |
An object with S3 class |
lambda.idx |
Indices of regularization parameters in the solution path to extract. By default, at most the first three fitted path points are used. |
beta.idx |
Indices of coefficient entries to extract. By default, at most the first three coefficients are used. |
... |
Arguments to be passed to methods. |
A numeric matrix of extracted coefficients.
Columns correspond to lambda.idx. Rows contain the intercept
("(Intercept)") and the selected coefficients
("beta[i]" for i in beta.idx).
Jason Ge, Xingguo Li, Haoming Jiang, Mengdi Wang, Tong Zhang, Han Liu and Tuo Zhao
Maintainer: Tuo Zhao <[email protected]>
picasso and picasso-package.
"sqrtlasso"
Extract estimated coefficient vectors from selected points on the regularization path.
## S3 method for class 'sqrtlasso' coef(object, lambda.idx = NULL, beta.idx = NULL, ...)## S3 method for class 'sqrtlasso' coef(object, lambda.idx = NULL, beta.idx = NULL, ...)
object |
An object with S3 class |
lambda.idx |
Indices of regularization parameters in the solution path to extract. By default, at most the first three fitted path points are used. |
beta.idx |
Indices of coefficient entries to extract. By default, at most the first three coefficients are used. |
... |
Arguments to be passed to methods. |
A numeric matrix of extracted coefficients.
Columns correspond to lambda.idx. Rows contain the intercept
("(Intercept)") and the selected coefficients
("beta[i]" for i in beta.idx).
Jason Ge, Xingguo Li, Haoming Jiang, Mengdi Wang, Tong Zhang, Han Liu and Tuo Zhao
Maintainer: Tuo Zhao <[email protected]>
picasso and picasso-package.
Performs K-fold cross-validation to select the regularization parameter for
picasso models. Multinomial models use a fixed full-data class map and
softmax negative log-likelihood or misclassification loss.
cv.picasso(X, Y, ..., nfolds = 10, foldid = NULL, type.measure = "default", fast.mode = FALSE) ## S3 method for class 'cv.picasso' print(x, ...) ## S3 method for class 'cv.picasso' plot(x, sign.lambda = 1, ...) ## S3 method for class 'cv.picasso' coef(object, s = c("lambda.min", "lambda.1se"), ...) ## S3 method for class 'cv.picasso' predict(object, newdata, s = c("lambda.min", "lambda.1se"), type = "response", ...)cv.picasso(X, Y, ..., nfolds = 10, foldid = NULL, type.measure = "default", fast.mode = FALSE) ## S3 method for class 'cv.picasso' print(x, ...) ## S3 method for class 'cv.picasso' plot(x, sign.lambda = 1, ...) ## S3 method for class 'cv.picasso' coef(object, s = c("lambda.min", "lambda.1se"), ...) ## S3 method for class 'cv.picasso' predict(object, newdata, s = c("lambda.min", "lambda.1se"), type = "response", ...)
X |
Numeric design matrix, |
Y |
Response vector. A one-column Gaussian response matrix is accepted for compatibility. |
... |
Additional arguments passed to |
nfolds |
Number of cross-validation folds. Default is |
foldid |
Optional integer vector of fold assignments (length |
type.measure |
Loss measure for cross-validation. |
fast.mode |
Logical precision preset passed consistently to the
full-data and fold fits. With the default |
x |
A |
object |
A |
s |
Which lambda to use: |
sign.lambda |
Multiplier for the x-axis of the CV plot ( |
newdata |
Matrix of new observations for prediction. |
type |
Prediction type; passed to the underlying |
Every binomial or multinomial training fold must contain every class observed
in the full data; automatic stratification therefore requires at least two
observations per class. A custom foldid that violates this rule or a
failed, truncated, or otherwise unusable fold fit produces an explicit error
rather than silently omitting the fold. Normal deviance-tail stopping may
shorten the initial full-data generated path; that retained path is then
passed explicitly to every fold and must be covered in full.
An unusually deep scalar path can make a training fold reach normal
saturation before completing that fixed sequence. This is reported as a
truncated-fold error; request fewer lambdas or a larger
lambda.min.ratio when it occurs.
Binomial factor responses use the full-data two-level map in every fold and
are scored as zero/one outcomes. When predicting from an offset-fitted
binomial or Poisson cv.picasso object, pass newoffset through
... to the underlying prediction method.
For Gaussian models, the full-data type.gaussian = "auto" decision is
also reused in every fold, so changing training-fold sample sizes cannot switch
the native backend.
cv.picasso returns an object of class "cv.picasso" with components:
Ordered lambda sequence evaluated by every fold. A generated full-data fit may first stop normally and thereby establish a shorter path; every fold must then cover that fixed sequence completely.
Mean cross-validated error for each lambda.
Standard error of the mean cross-validated error.
Upper and lower error-bar bounds.
Number of nonzero coefficients at each lambda. For multinomial models this is the total across all classes.
Lambda that minimises cvm.
Largest lambda within one standard error of the minimum.
Name of the loss measure used.
Fold assignment used for each observation.
Model family.
Logical precision preset used for all fits.
Effective convergence tolerance used for all fits.
Full-data picasso fit.
print.cv.picasso returns its input invisibly, and
plot.cv.picasso draws the CV curve and returns NULL invisibly.
coef.cv.picasso and predict.cv.picasso return the corresponding
underlying fit-method result at lambda.min or lambda.1se.
Jason Ge, Xingguo Li, Haoming Jiang, Mengdi Wang, Tong Zhang, Han Liu and Tuo Zhao
Maintainer: Tuo Zhao <[email protected]>
set.seed(1) n <- 100; d <- 50 X <- matrix(rnorm(n * d), n, d) Y <- X[, 1:5] %*% rnorm(5) + rnorm(n) cv <- cv.picasso(X, Y, family = "gaussian", nlambda = 20) print(cv$lambda.min)set.seed(1) n <- 100; d <- 50 X <- matrix(rnorm(n * d), n, d) Y <- X[, 1:5] %*% rnorm(5) + rnorm(n) cv <- cv.picasso(X, Y, family = "gaussian", nlambda = 20) print(cv$lambda.min)
Gene expression data (200 genes, 120 samples) from microarray experiments on mammalian eye tissue reported by Scheetz et al. (2006).
data(eyedata)data(eyedata)
A list with components:
A 120 by 200 matrix of gene probes.
A numeric response vector of length 120 representing the expression level of the TRIM32 gene.
This data set contains 120 samples and 200 predictors.
Xingguo Li, Tuo Zhao, Tong Zhang and Han Liu
Maintainer: Tuo Zhao <[email protected]>
1. T. Scheetz, K. Kim, R. Swiderski, A. Philp, T. Braun, K. Knudtson, A. Dorrance, G. DiBona, J. Huang, T. Casavant, V. Sheffield, and E. Stone. Regulation of gene expression in the mammalian eye and its relevance to eye disease. Proceedings of the National Academy of Sciences of the United States of America, 2006.
data(eyedata) image(eyedata$x)data(eyedata) image(eyedata$x)
Fit multinomial models with picasso using
family = "multinomial", then print, plot, extract coefficients, or
predict from the fitted class-coupled regularization path.
## S3 method for class 'multinomial' print(x, ...) ## S3 method for class 'multinomial' plot(x, which.class = 1, ...) ## S3 method for class 'multinomial' coef(object, lambda.idx = NULL, beta.idx = NULL, ...) ## S3 method for class 'multinomial' predict(object, newdata, lambda.idx = NULL, type = "response", s = NULL, ...)## S3 method for class 'multinomial' print(x, ...) ## S3 method for class 'multinomial' plot(x, which.class = 1, ...) ## S3 method for class 'multinomial' coef(object, lambda.idx = NULL, beta.idx = NULL, ...) ## S3 method for class 'multinomial' predict(object, newdata, lambda.idx = NULL, type = "response", s = NULL, ...)
x |
A fitted object with S3 class |
object |
A fitted object with S3 class |
which.class |
One-based class index whose coefficient path is plotted.
The default is |
lambda.idx |
One-based lambda indices for extraction or prediction.
If |
beta.idx |
One-based feature indices to extract. If |
newdata |
Finite numeric matrix of new observations with the same number of columns as the fitted design. |
type |
Prediction type. |
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.
|
... |
Additional arguments (currently unused). |
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.
print.multinomial returns x invisibly.
plot.multinomial draws one class's coefficient paths and returns
NULL invisibly.
coef.multinomial returns a list of 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
matrix for "response" or
"link", a factor of length for "class",
or a list of 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.
Jason Ge, Xingguo Li, Haoming Jiang, Mengdi Wang, Tong Zhang, Han Liu and Tuo Zhao
Maintainer: Tuo Zhao <[email protected]>
picasso, cv.picasso, and
assess.picasso.
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")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")
picasso fits regularization paths for sparse Gaussian, logistic
(family = "binomial"), Poisson, sqrt-lasso, and multinomial models
using lasso, MCP, or SCAD penalties.
picasso(X, Y, lambda = NULL, nlambda = 100, lambda.min.ratio = 0.05, family = "gaussian", method = "l1", type.gaussian = "auto", gamma = 3, df = NULL, dfmax = NULL, standardize = TRUE, intercept = TRUE, prec = 1e-07, max.ite = 1000, verbose = FALSE, offset = NULL, lla.max.stages = 3L, fast.mode = FALSE)picasso(X, Y, lambda = NULL, nlambda = 100, lambda.min.ratio = 0.05, family = "gaussian", method = "l1", type.gaussian = "auto", gamma = 3, df = NULL, dfmax = NULL, standardize = TRUE, intercept = TRUE, prec = 1e-07, max.ite = 1000, verbose = FALSE, offset = NULL, lla.max.stages = 3L, fast.mode = FALSE)
X |
Numeric design matrix with |
Y |
Response vector of length |
lambda |
Optional finite, non-negative, strictly decreasing sequence of
regularization values. If |
nlambda |
Positive integer number of regularization values to generate when
|
lambda.min.ratio |
Smallest generated |
family |
Model family. Supported values are |
method |
Penalty type. Supported values are |
type.gaussian |
Gaussian solver mode. |
gamma |
Concavity parameter for MCP and SCAD penalties. MCP requires
|
df |
Reserved for backward compatibility with older Gaussian covariance-update implementations. It is currently not used by the active solver backend. |
dfmax |
Nonzero-count threshold for early stopping on the lambda path. The crossing
model is committed before stopping, so this is not a hard upper bound. If
|
standardize |
If |
intercept |
If |
prec |
Convergence tolerance used when |
max.ite |
Maximum number of native solver iterations. For Gaussian models it bounds
coordinate-descent sweeps at each lambda. For binomial, Poisson,
sqrt-lasso, and multinomial models, it bounds active-set subproblem work
within each weighted-L1 problem and is distinct from
|
lla.max.stages |
Maximum total number of local-linear-approximation (LLA) stages for MCP
and SCAD binomial, Poisson, sqrt-lasso, and multinomial fits. The count
includes the initial L1 master, so the default |
verbose |
If |
offset |
Optional numeric vector of length |
fast.mode |
Logical precision preset. The default |
When lambda is not supplied, picasso constructs a logarithmically
spaced path between and
.
The method solves a penalized optimization problem:
where is lasso, MCP, or SCAD.
For multinomial models, the penalty term is instead
; intercepts are never penalized.
Loss functions by family are:
"gaussian":
.
"binomial":
.
"poisson":
.
"sqrtlasso":
.
"multinomial":
.
For binomial and Poisson models, ,
where is the supplied offset or zero.
Gaussian paths use active-set coordinate descent with residual or lazy covariance updates. Binomial and Poisson weighted-L1 subproblems use active-set Proximal Newton/IRLS, square-root-lasso uses a global quadratic majorizer with active-set coordinate updates, and multinomial uses class-coupled active-set Proximal Newton/IRLS. MCP and SCAD use adaptive LLA around those weighted-L1 solvers except for the direct Gaussian nonconvex coordinate-descent implementation.
A fitted object of class "gaussian", "logit",
"poisson", "sqrtlasso", or "multinomial" depending on
family.
Common components include:
A Matrix object of dimension
containing fitted coefficients. Its concrete
representation may be sparse or dense. Multinomial fits instead return a
list of such objects, one per class.
Numeric vector of intercepts. Multinomial fits return a
list of numeric vectors, one per class.
Regularization sequence used for fitting.
Number of regularization values.
Degrees of freedom (number of nonzero coefficients) along the path.
Null-model loss or deviance under the fitted intercept convention and family-specific scale.
Fraction of null deviance explained at each lambda,
analogous to for Gaussian fits. Values are clipped to zero through
one.
Penalty type used for fitting.
Identifier for the resolved native algorithm.
Iteration information returned by the solver.
Input verbose value.
Elapsed fitting time.
Input family value.
Logical precision preset used for fitting.
Effective convergence tolerance used by the native solver.
For Gaussian fits, the requested solver mode.
For Gaussian fits, the resolved native solver mode.
Native termination label. Gaussian iteration-limit failures retain only the previously converged lambda prefix.
Integer form of status.
Details for the first uncommitted hard failure, otherwise
NULL.
Binomial, Poisson, sqrt-lasso, and multinomial fits additionally include:
Native per-lambda runtime.
Requested adaptive-LLA stage budget.
Per-lambda runtime, penalized objective, weighted-L1 KKT residual, and target stationarity. Scalar-family diagnostics also report solver iterations, active-set size, and completed LLA stages; multinomial diagnostics instead report outer iterations, inner sweeps, coordinate updates, and active-set size.
For non-Gaussian MCP/SCAD fits, status lla_stationarity_limit means
that every returned model is usable, but at least one point reached its
LLA-stage budget before meeting prec.
Native path fitting polls for a pending user interrupt (Ctrl-C) at
every lambda boundary, so a long path can be stopped without waiting for
completion; the interrupt is then raised as a standard R interrupt
condition. A single very expensive lambda still runs to completion before
the poll.
Multinomial fits also include path.early.stopped and
requested.nlambda. A successful automatically generated path may
contain fewer lambdas than requested after its deviance has saturated.
Explicit paths do not apply saturation stopping, but may still be truncated
by dfmax or a hard failure. Every retained weighted-L1
subproblem meets its KKT tolerance; for MCP/SCAD, inspect target stationarity
when status.code == 10.
Binomial and Poisson fits include offset.used, a logical flag recording
whether offset was explicitly supplied. Binomial fits include the two
response levels used for zero/one encoding; multinomial fits include
K and the retained class levels.
Jason Ge, Xingguo Li, Haoming Jiang, Mengdi Wang, Tong Zhang, Han Liu and Tuo Zhao
Maintainer: Tuo Zhao <[email protected]>
1. J. Friedman, T. Hastie, H. Hofling, and R. Tibshirani. Pathwise coordinate optimization. The Annals of Applied Statistics, 2007.
2. C.-H. Zhang. Nearly unbiased variable selection under minimax concave penalty. The Annals of Statistics, 2010.
3. J. Fan and R. Li. Variable selection via nonconcave penalized likelihood and its oracle properties. Journal of the American Statistical Association, 2001.
4. R. Tibshirani, J. Bien, J. Friedman, T. Hastie, N. Simon, J. Taylor, and R. Tibshirani. Strong rules for discarding predictors in lasso-type problems. Journal of the Royal Statistical Society: Series B, 2012.
5. J. Ge, X. Li, H. Jiang, H. Liu, T. Zhang, M. Wang, and T. Zhao. PICASSO: A sparse learning library for high-dimensional data analysis in R and Python. Journal of Machine Learning Research, 20(44):1–5, 2019. https://www.jmlr.org/papers/v20/17-722.html.
################################################################ ## Sparse linear regression ## Generate the design matrix and regression coefficient vector n = 100 # sample number d = 80 # sample dimension c = 0.5 # correlation parameter s = 20 # support size of coefficient set.seed(2016) X = scale(matrix(rnorm(n*d),n,d)+c*rnorm(n))/sqrt(n-1)*sqrt(n) beta = c(runif(s), rep(0, d-s)) ## Generate response using Gaussian noise, and fit sparse linear models noise = rnorm(n) Y = X%*%beta + noise ## automatic Gaussian backend selection (the default) fitted.l1.auto = picasso(X, Y, nlambda=100) ## l1 regularization solved with naive update fitted.l1.naive = picasso(X, Y, nlambda=100, type.gaussian="naive") ## covariance updates can be faster when n >> d fitted.l1.covariance = picasso(X, Y, nlambda=100, type.gaussian="covariance") ## early stopping: stop when more than 10 nonzero coefficients fitted.l1.dfmax = picasso(X, Y, nlambda=100, dfmax=10) ## mcp regularization fitted.mcp = picasso(X, Y, nlambda=100, method="mcp") ## scad regularization fitted.scad = picasso(X, Y, nlambda=100, method="scad") ## lambdas used print(fitted.l1.naive$lambda) ## number of nonzero coefficients for each lambda print(fitted.l1.naive$df) ## coefficients and intercept for the i-th lambda i = 30 print(fitted.l1.naive$lambda[i]) print(fitted.l1.naive$beta[,i]) print(fitted.l1.naive$intercept[i]) ## Visualize the solution path plot(fitted.l1.naive) plot(fitted.l1.covariance) plot(fitted.mcp) plot(fitted.scad) ################################################################ ## Sparse logistic regression ## Generate the design matrix and regression coefficient vector n <- 100 # sample number d <- 80 # sample dimension c <- 0.5 # parameter controlling the correlation between columns of X s <- 20 # support size of coefficient set.seed(2016) X <- scale(matrix(rnorm(n*d),n,d)+c*rnorm(n))/sqrt(n-1)*sqrt(n) beta <- c(runif(s), rep(0, d-s)) ## Generate response and fit sparse logistic models p = 1/(1+exp(-X%*%beta)) Y = rbinom(n, rep(1,n), p) ## l1 regularization fitted.l1 = picasso(X, Y, nlambda=100, family="binomial", method="l1") ## mcp regularization fitted.mcp = picasso(X, Y, nlambda=100, family="binomial", method="mcp") ## scad regularization fitted.scad = picasso(X, Y, nlambda=100, family="binomial", method="scad") ## lambdas used print(fitted.l1$lambda) ## number of nonzero coefficients for each lambda print(fitted.l1$df) ## coefficients and intercept for the i-th lambda i = 30 print(fitted.l1$lambda[i]) print(fitted.l1$beta[,i]) print(fitted.l1$intercept[i]) ## Visualize the solution path plot(fitted.l1) ## Predicted probabilities for the first 5 observations at lambda[30] param.l1 = predict(fitted.l1, X[1:5, ], lambda.idx = 30, type = "response") ################################################################ ## Sparse poisson regression ## Generate the design matrix and regression coefficient vector n <- 100 # sample number d <- 80 # sample dimension c <- 0.5 # parameter controlling the correlation between columns of X s <- 20 # support size of coefficient set.seed(2016) X <- scale(matrix(rnorm(n*d),n,d)+c*rnorm(n))/sqrt(n-1)*sqrt(n) beta <- c(runif(s), rep(0, d-s))/sqrt(s) ## Generate response and fit sparse poisson models p = X%*%beta+rnorm(n) Y = rpois(n, exp(p)) ## l1 regularization fitted.l1 = picasso(X, Y, nlambda=100, family="poisson", method="l1") ## mcp regularization fitted.mcp = picasso(X, Y, nlambda=100, family="poisson", method="mcp") ## scad regularization fitted.scad = picasso(X, Y, nlambda=100, family="poisson", method="scad") ## lambdas used print(fitted.l1$lambda) ## number of nonzero coefficients for each lambda print(fitted.l1$df) ## coefficients and intercept for the i-th lambda i = 30 print(fitted.l1$lambda[i]) print(fitted.l1$beta[,i]) print(fitted.l1$intercept[i]) ## Visualize the solution path plot(fitted.l1) ################################################################ ## Square-root-lasso set.seed(2) X <- matrix(rnorm(80 * 12), 80, 12) Y <- X[, 1] - X[, 2] + rnorm(80) fitted.sqrt <- picasso( X, Y, family = "sqrtlasso", nlambda = 12, method = "l1" ) predict(fitted.sqrt, X[1:3, ], lambda.idx = fitted.sqrt$nlambda) ################################################################ ## Multinomial regression with retained class labels score <- cbind(X[, 1], -X[, 1] + X[, 2], -X[, 2]) Y <- factor(c("red", "green", "blue")[max.col(score)]) fitted.multi <- picasso( X, Y, family = "multinomial", nlambda = 12, method = "l1" ) predict(fitted.multi, X[1:3, ], lambda.idx = fitted.multi$nlambda, type = "class")################################################################ ## Sparse linear regression ## Generate the design matrix and regression coefficient vector n = 100 # sample number d = 80 # sample dimension c = 0.5 # correlation parameter s = 20 # support size of coefficient set.seed(2016) X = scale(matrix(rnorm(n*d),n,d)+c*rnorm(n))/sqrt(n-1)*sqrt(n) beta = c(runif(s), rep(0, d-s)) ## Generate response using Gaussian noise, and fit sparse linear models noise = rnorm(n) Y = X%*%beta + noise ## automatic Gaussian backend selection (the default) fitted.l1.auto = picasso(X, Y, nlambda=100) ## l1 regularization solved with naive update fitted.l1.naive = picasso(X, Y, nlambda=100, type.gaussian="naive") ## covariance updates can be faster when n >> d fitted.l1.covariance = picasso(X, Y, nlambda=100, type.gaussian="covariance") ## early stopping: stop when more than 10 nonzero coefficients fitted.l1.dfmax = picasso(X, Y, nlambda=100, dfmax=10) ## mcp regularization fitted.mcp = picasso(X, Y, nlambda=100, method="mcp") ## scad regularization fitted.scad = picasso(X, Y, nlambda=100, method="scad") ## lambdas used print(fitted.l1.naive$lambda) ## number of nonzero coefficients for each lambda print(fitted.l1.naive$df) ## coefficients and intercept for the i-th lambda i = 30 print(fitted.l1.naive$lambda[i]) print(fitted.l1.naive$beta[,i]) print(fitted.l1.naive$intercept[i]) ## Visualize the solution path plot(fitted.l1.naive) plot(fitted.l1.covariance) plot(fitted.mcp) plot(fitted.scad) ################################################################ ## Sparse logistic regression ## Generate the design matrix and regression coefficient vector n <- 100 # sample number d <- 80 # sample dimension c <- 0.5 # parameter controlling the correlation between columns of X s <- 20 # support size of coefficient set.seed(2016) X <- scale(matrix(rnorm(n*d),n,d)+c*rnorm(n))/sqrt(n-1)*sqrt(n) beta <- c(runif(s), rep(0, d-s)) ## Generate response and fit sparse logistic models p = 1/(1+exp(-X%*%beta)) Y = rbinom(n, rep(1,n), p) ## l1 regularization fitted.l1 = picasso(X, Y, nlambda=100, family="binomial", method="l1") ## mcp regularization fitted.mcp = picasso(X, Y, nlambda=100, family="binomial", method="mcp") ## scad regularization fitted.scad = picasso(X, Y, nlambda=100, family="binomial", method="scad") ## lambdas used print(fitted.l1$lambda) ## number of nonzero coefficients for each lambda print(fitted.l1$df) ## coefficients and intercept for the i-th lambda i = 30 print(fitted.l1$lambda[i]) print(fitted.l1$beta[,i]) print(fitted.l1$intercept[i]) ## Visualize the solution path plot(fitted.l1) ## Predicted probabilities for the first 5 observations at lambda[30] param.l1 = predict(fitted.l1, X[1:5, ], lambda.idx = 30, type = "response") ################################################################ ## Sparse poisson regression ## Generate the design matrix and regression coefficient vector n <- 100 # sample number d <- 80 # sample dimension c <- 0.5 # parameter controlling the correlation between columns of X s <- 20 # support size of coefficient set.seed(2016) X <- scale(matrix(rnorm(n*d),n,d)+c*rnorm(n))/sqrt(n-1)*sqrt(n) beta <- c(runif(s), rep(0, d-s))/sqrt(s) ## Generate response and fit sparse poisson models p = X%*%beta+rnorm(n) Y = rpois(n, exp(p)) ## l1 regularization fitted.l1 = picasso(X, Y, nlambda=100, family="poisson", method="l1") ## mcp regularization fitted.mcp = picasso(X, Y, nlambda=100, family="poisson", method="mcp") ## scad regularization fitted.scad = picasso(X, Y, nlambda=100, family="poisson", method="scad") ## lambdas used print(fitted.l1$lambda) ## number of nonzero coefficients for each lambda print(fitted.l1$df) ## coefficients and intercept for the i-th lambda i = 30 print(fitted.l1$lambda[i]) print(fitted.l1$beta[,i]) print(fitted.l1$intercept[i]) ## Visualize the solution path plot(fitted.l1) ################################################################ ## Square-root-lasso set.seed(2) X <- matrix(rnorm(80 * 12), 80, 12) Y <- X[, 1] - X[, 2] + rnorm(80) fitted.sqrt <- picasso( X, Y, family = "sqrtlasso", nlambda = 12, method = "l1" ) predict(fitted.sqrt, X[1:3, ], lambda.idx = fitted.sqrt$nlambda) ################################################################ ## Multinomial regression with retained class labels score <- cbind(X[, 1], -X[, 1] + X[, 2], -X[, 2]) Y <- factor(c("red", "green", "blue")[max.col(score)]) fitted.multi <- picasso( X, Y, family = "multinomial", nlambda = 12, method = "l1" ) predict(fitted.multi, X[1:3, ], lambda.idx = fitted.multi$nlambda, type = "class")
"gaussian"
Plot coefficient paths across regularization parameters.
## S3 method for class 'gaussian' plot(x, ...)## S3 method for class 'gaussian' plot(x, ...)
x |
An object with S3 class |
... |
Arguments to be passed to methods. |
No return value, called for side effects (drawing the coefficient-path plot).
Jason Ge, Xingguo Li, Haoming Jiang, Mengdi Wang, Tong Zhang, Han Liu and Tuo Zhao
Maintainer: Tuo Zhao <[email protected]>
picasso and picasso-package.
"logit"
Plot coefficient paths across regularization parameters.
## S3 method for class 'logit' plot(x, ...)## S3 method for class 'logit' plot(x, ...)
x |
An object with S3 class |
... |
Arguments to be passed to methods. |
No return value, called for side effects (drawing the coefficient-path plot).
Jason Ge, Xingguo Li, Haoming Jiang, Mengdi Wang, Tong Zhang, Han Liu and Tuo Zhao
Maintainer: Tuo Zhao <[email protected]>
picasso and picasso-package.
"poisson"
Plot coefficient paths across regularization parameters.
## S3 method for class 'poisson' plot(x, ...)## S3 method for class 'poisson' plot(x, ...)
x |
An object with S3 class |
... |
Arguments to be passed to methods. |
No return value, called for side effects (drawing the coefficient-path plot).
Jason Ge, Xingguo Li, Haoming Jiang, Mengdi Wang, Tong Zhang, Han Liu and Tuo Zhao
Maintainer: Tuo Zhao <[email protected]>
picasso and picasso-package.
"sqrtlasso"
Plot coefficient paths across regularization parameters.
## S3 method for class 'sqrtlasso' plot(x, ...)## S3 method for class 'sqrtlasso' plot(x, ...)
x |
An object with S3 class |
... |
Arguments to be passed to methods. |
No return value, called for side effects (drawing the coefficient-path plot).
Jason Ge, Xingguo Li, Haoming Jiang, Mengdi Wang, Tong Zhang, Han Liu and Tuo Zhao
Maintainer: Tuo Zhao <[email protected]>
picasso and picasso-package.
"gaussian"
Predict responses for new data using fitted models.
## S3 method for class 'gaussian' predict(object, newdata, lambda.idx = NULL, Y.pred.idx = NULL, type = "response", s = NULL, ...)## S3 method for class 'gaussian' predict(object, newdata, lambda.idx = NULL, Y.pred.idx = NULL, type = "response", s = NULL, ...)
object |
An object with S3 class |
newdata |
Nonempty finite numeric matrix of new observations for prediction
( |
lambda.idx |
Positive integer indices of regularization parameters along the solution path used for prediction. By default, at most the first three fitted path points are used. |
Y.pred.idx |
Optional row indices to subset returned predictions. |
type |
Type of prediction. |
s |
Optional nonempty vector of finite non-negative lambda values (not
indices). When
supplied, |
... |
Arguments to be passed to methods. |
predict.gaussian returns predicted responses for newdata using fitted coefficients from object:
Return type depends on type:
"response" or "link" (default): numeric matrix of
predicted values .
"nonzero": list of integer vectors of nonzero coefficient indices,
one element per selected lambda.
Rows correspond to observations; columns correspond to lambda.idx (or
s values when s is specified).
Jason Ge, Xingguo Li, Haoming Jiang, Mengdi Wang, Tong Zhang, Han Liu and Tuo Zhao
Maintainer: Tuo Zhao <[email protected]>
picasso and picasso-package.
"logit"
Predict responses for new data using fitted models.
## S3 method for class 'logit' predict(object, newdata, lambda.idx = NULL, p.pred.idx = NULL, type = "response", s = NULL, newoffset = NULL, ...)## S3 method for class 'logit' predict(object, newdata, lambda.idx = NULL, p.pred.idx = NULL, type = "response", s = NULL, newoffset = NULL, ...)
object |
An object with S3 class |
newdata |
Nonempty finite numeric matrix of new observations for prediction
( |
lambda.idx |
Positive integer indices of regularization parameters along the solution path used for prediction. By default, at most the first three fitted path points are used. |
p.pred.idx |
Optional row indices to subset returned predictions. |
type |
Type of prediction. |
s |
Optional nonempty vector of finite non-negative lambda values; see
|
newoffset |
Optional finite numeric vector with one offset per row of |
... |
Arguments to be passed to methods. |
predict.logit returns predicted Bernoulli probabilities for newdata using fitted coefficients from object:
Return type depends on type:
"response" (default): numeric matrix of predicted probabilities
.
"link": numeric matrix of log-odds
.
"class": integer matrix of predicted class labels (0 or 1).
"nonzero": list of integer vectors of nonzero coefficient indices,
one element per selected lambda.
Rows correspond to observations; columns correspond to lambda.idx (or
s values when s is specified).
Jason Ge, Xingguo Li, Haoming Jiang, Mengdi Wang, Tong Zhang, Han Liu and Tuo Zhao
Maintainer: Tuo Zhao <[email protected]>
picasso and picasso-package.
"poisson"
Predict responses for new data using fitted models.
## S3 method for class 'poisson' predict(object, newdata, lambda.idx = NULL, p.pred.idx = NULL, type = "response", s = NULL, newoffset = NULL, ...)## S3 method for class 'poisson' predict(object, newdata, lambda.idx = NULL, p.pred.idx = NULL, type = "response", s = NULL, newoffset = NULL, ...)
object |
An object with S3 class |
newdata |
Nonempty finite numeric matrix of new observations for prediction
( |
lambda.idx |
Positive integer indices of regularization parameters along the solution path used for prediction. By default, at most the first three fitted path points are used. |
p.pred.idx |
Optional row indices to subset returned predictions. |
type |
Type of prediction. |
s |
Optional nonempty vector of finite non-negative lambda values; see
|
newoffset |
Optional finite numeric vector with one offset per row of |
... |
Arguments to be passed to methods. |
predict.poisson returns predicted Poisson means for newdata using fitted coefficients from object:
Return type depends on type:
"response" (default): numeric matrix of predicted Poisson means
.
"link": numeric matrix of log-means
.
"nonzero": list of integer vectors of nonzero coefficient indices,
one element per selected lambda.
Rows correspond to observations; columns correspond to lambda.idx (or
s values when s is specified).
Jason Ge, Xingguo Li, Haoming Jiang, Mengdi Wang, Tong Zhang, Han Liu and Tuo Zhao
Maintainer: Tuo Zhao <[email protected]>
picasso and picasso-package.
"sqrtlasso"
Predict responses for new data using fitted models.
## S3 method for class 'sqrtlasso' predict(object, newdata, lambda.idx = NULL, Y.pred.idx = NULL, type = "response", s = NULL, ...)## S3 method for class 'sqrtlasso' predict(object, newdata, lambda.idx = NULL, Y.pred.idx = NULL, type = "response", s = NULL, ...)
object |
An object with S3 class |
newdata |
Nonempty finite numeric matrix of new observations for prediction
( |
lambda.idx |
Positive integer indices of regularization parameters along the solution path used for prediction. By default, at most the first three fitted path points are used. |
Y.pred.idx |
Optional row indices to subset returned predictions. |
type |
Type of prediction. |
s |
Optional nonempty vector of finite non-negative lambda values; see
|
... |
Arguments to be passed to methods. |
predict.sqrtlasso returns predicted responses for newdata using fitted coefficients from object:
Return type depends on type:
"response" or "link" (default): numeric matrix of
predicted values .
"nonzero": list of integer vectors of nonzero coefficient indices,
one element per selected lambda.
Rows correspond to observations; columns correspond to lambda.idx (or
s values when s is specified).
Jason Ge, Xingguo Li, Haoming Jiang, Mengdi Wang, Tong Zhang, Han Liu and Tuo Zhao
Maintainer: Tuo Zhao <[email protected]>
picasso and picasso-package.
"gaussian"
Print a concise summary for an object with S3 class "gaussian".
## S3 method for class 'gaussian' print(x, ...)## S3 method for class 'gaussian' print(x, ...)
x |
An object with S3 class |
... |
Arguments to be passed to methods. |
This method prints tuning parameters and fit statistics for a fitted model object.
The input object x, returned invisibly.
Jason Ge, Xingguo Li, Haoming Jiang, Mengdi Wang, Tong Zhang, Han Liu and Tuo Zhao
Maintainer: Tuo Zhao <[email protected]>
picasso and picasso-package.
"logit"
Print a concise summary for an object with S3 class "logit".
## S3 method for class 'logit' print(x, ...)## S3 method for class 'logit' print(x, ...)
x |
An object with S3 class |
... |
Arguments to be passed to methods. |
This method prints tuning parameters and fit statistics for a fitted logistic model object.
The input object x, returned invisibly.
Jason Ge, Xingguo Li, Haoming Jiang, Mengdi Wang, Tong Zhang, Han Liu and Tuo Zhao
Maintainer: Tuo Zhao <[email protected]>
picasso and picasso-package.
"poisson"
Print a concise summary for an object with S3 class "poisson".
## S3 method for class 'poisson' print(x, ...)## S3 method for class 'poisson' print(x, ...)
x |
An object with S3 class |
... |
Arguments to be passed to methods. |
This method prints tuning parameters and fit statistics for a fitted Poisson model object.
The input object x, returned invisibly.
Jason Ge, Xingguo Li, Haoming Jiang, Mengdi Wang, Tong Zhang, Han Liu and Tuo Zhao
Maintainer: Tuo Zhao <[email protected]>
picasso and picasso-package.
"sqrtlasso"
Print a concise summary for an object with S3 class "sqrtlasso".
## S3 method for class 'sqrtlasso' print(x, ...)## S3 method for class 'sqrtlasso' print(x, ...)
x |
An object with S3 class |
... |
Arguments to be passed to methods. |
This method prints tuning parameters and fit statistics for a fitted model object.
The input object x, returned invisibly.
Jason Ge, Xingguo Li, Haoming Jiang, Mengdi Wang, Tong Zhang, Han Liu and Tuo Zhao
Maintainer: Tuo Zhao <[email protected]>
picasso and picasso-package.