predict.cv.gglasso {gglasso} | R Documentation |
This function makes predictions from a cross-validated gglasso
model,
using the stored "gglasso.fit"
object, and the optimal value
chosen for lambda
.
## S3 method for class 'cv.gglasso' predict(object, newx, s=c("lambda.1se","lambda.min"),...)
object |
fitted |
newx |
matrix of new values for |
s |
value(s) of the penalty parameter |
... |
not used. Other arguments to predict. |
This function makes it easier to use the results of cross-validation to make a prediction.
The returned object depends on the ... argument which is passed on
to the predict
method for gglasso
objects.
Yi Yang and Hui Zou
Maintainer: Yi Yang <yi.yang6@mcgill.ca>
Yang, Y. and Zou, H. (2015), “A Fast Unified Algorithm for Computing Group-Lasso Penalized Learning Problems,” Statistics and Computing. 25(6), 1129-1141.
BugReport: https://github.com/emeryyi/gglasso
cv.gglasso
, and coef.cv.gglasso
methods.
# load gglasso library library(gglasso) # load data set data(colon) # define group index group <- rep(1:20,each=5) # 5-fold cross validation using group lasso # penalized logisitic regression cv <- cv.gglasso(x=colon$x, y=colon$y, group=group, loss="logit", pred.loss="misclass", lambda.factor=0.05, nfolds=5) # the coefficients at lambda = lambda.min, newx = x[1,] pre = predict(cv$gglasso.fit, newx = colon$x[1:10,], s = cv$lambda.min, type = "class")