cv.MLGL | R Documentation |
V-fold cross validation for MLGL
function
cv.MLGL(
X,
y,
nfolds = 5,
lambda = NULL,
hc = NULL,
weightLevel = NULL,
weightSizeGroup = NULL,
loss = c("ls", "logit"),
intercept = TRUE,
sizeMaxGroup = NULL,
verbose = FALSE,
...
)
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 |
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.
a cv.MLGL object containing:
values of lambda
.
the mean cross-validated error.
estimate of standard error of cvm
upper curve = cvm+cvsd
lower curve = cvm-cvsd
The optimal value of lambda
that gives minimum cross validation error cvm
.
The largest value of lambda
such that error is within 1 standard error of the minimum.
computation time
Quentin Grimonprez
MLGL, stability.MLGL, predict.cv.gglasso, coef.cv.MLGL, plot.cv.MLGL
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.