predict.grpnet {adelie} | R Documentation |
make predictions from a "grpnet" object.
Description
Similar to other predict methods, this functions predicts linear predictors,
coefficients and more from a fitted "grpnet"
object.
Usage
## S3 method for class 'grpnet'
predict(
object,
newx,
lambda = NULL,
type = c("link", "response", "coefficients"),
newoffsets = NULL,
...
)
## S3 method for class 'grpnet'
coef(object, lambda = NULL, ...)
Arguments
object |
Fitted |
newx |
Matrix of new values for |
lambda |
Value(s) of the penalty parameter |
type |
Type of prediction required. Type |
newoffsets |
If an offset is used in the fit, then one must be supplied
for making predictions (except for |
... |
Currently ignored. |
Details
The shape of the objects returned are different for "multinomial"
and "multigaussian"
objects
coef(...)
is equivalent to predict(type="coefficients",...)
Value
The object returned depends on type.
Author(s)
James Yang, Trevor Hastie, and Balasubramanian Narasimhan
Maintainer: Trevor Hastie
hastie@stanford.edu
References
Yang, James and Hastie, Trevor. (2024) A Fast and Scalable Pathwise-Solver for Group Lasso
and Elastic Net Penalized Regression via Block-Coordinate Descent. arXiv doi:10.48550/arXiv.2405.08631.
Adelie Python user guide https://jamesyang007.github.io/adelie/
See Also
grpnet
, and print
, and coef
methods, and
cv.grpnet
.
Examples
set.seed(0)
n <- 100
p <- 200
X <- matrix(rnorm(n * p), n, p)
y <- X[,1] * rnorm(1) + rnorm(n)
fit <- grpnet(X, glm.gaussian(y))
coef(fit)
predict(fit,newx = X[1:5,])