cv.MLGL {MLGL} | R Documentation |
Multi-Layer Group-Lasso with cross V-fold validation
Description
V-fold cross validation for MLGL
function
Usage
cv.MLGL(
X,
y,
nfolds = 5,
lambda = NULL,
hc = NULL,
weightLevel = NULL,
weightSizeGroup = NULL,
loss = c("ls", "logit"),
intercept = TRUE,
sizeMaxGroup = NULL,
verbose = FALSE,
...
)
Arguments
X |
matrix of size n*p |
y |
vector of size n. If loss = "logit", elements of y must be in -1,1 |
nfolds |
number of folds |
lambda |
lambda values for group lasso. If not provided, the function generates its own values of lambda |
hc |
output of |
weightLevel |
a vector of size p for each level of the hierarchy. A zero indicates that the level will be ignored. If not provided, use 1/(height between 2 successive levels) |
weightSizeGroup |
a vector |
loss |
a character string specifying the loss function to use, valid options are: "ls" least squares loss (regression) and "logit" logistic loss (classification) |
intercept |
should an intercept be included in the model ? |
sizeMaxGroup |
maximum size of selected groups. If NULL, no restriction |
verbose |
print some informations |
... |
Others parameters for |
Details
Hierarchical clustering is performed with all the variables. Then, the partitions from the different levels of the hierarchy are used in the different run of MLGL for cross validation.
Value
a cv.MLGL object containing:
- lambda
values of
lambda
.- cvm
the mean cross-validated error.
- cvsd
estimate of standard error of
cvm
- cvupper
upper curve =
cvm+cvsd
- cvlower
lower curve =
cvm-cvsd
- lambda.min
The optimal value of
lambda
that gives minimum cross validation errorcvm
.- lambda.1se
The largest value of
lambda
such that error is within 1 standard error of the minimum.- time
computation time
Author(s)
Quentin Grimonprez
See Also
MLGL, stability.MLGL, predict.cv.gglasso, coef.cv.MLGL, plot.cv.MLGL
Examples
set.seed(42)
# Simulate gaussian data with block-diagonal variance matrix containing 12 blocks of size 5
X <- simuBlockGaussian(50, 12, 5, 0.7)
# Generate a response variable
y <- X[, c(2, 7, 12)] %*% c(2, 2, -2) + rnorm(50, 0, 0.5)
# Apply cv.MLGL method
res <- cv.MLGL(X, y)