MLGL | R Documentation |
Run hierarchical clustering following by a group-lasso on all the different partitions.
MLGL(X, ...)
## Default S3 method:
MLGL(
X,
y,
hc = NULL,
lambda = NULL,
weightLevel = NULL,
weightSizeGroup = NULL,
intercept = TRUE,
loss = c("ls", "logit"),
sizeMaxGroup = NULL,
verbose = FALSE,
...
)
## S3 method for class 'formula'
MLGL(
formula,
data,
hc = NULL,
lambda = NULL,
weightLevel = NULL,
weightSizeGroup = NULL,
intercept = TRUE,
loss = c("ls", "logit"),
verbose = FALSE,
...
)
X |
matrix of size n*p |
... |
Others parameters for |
y |
vector of size n. If loss = "logit", elements of y must be in -1,1 |
hc |
output of |
lambda |
lambda values for group lasso. If not provided, the function generates its own values of lambda |
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). Only if |
weightSizeGroup |
a vector of size 2*p-1 containing the weight for each group.
Default is the square root of the size of each group. Only if |
intercept |
should an intercept be included in the model ? |
loss |
a character string specifying the loss function to use, valid options are: "ls" least squares loss (regression) and "logit" logistic loss (classification) |
sizeMaxGroup |
maximum size of selected groups. If NULL, no restriction |
verbose |
print some information |
formula |
an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted. |
data |
an optional data.frame, list or environment (or object coercible by as.data.frame to a data.frame) containing the variables in the model. If not found in data, the variables are taken from environment (formula) |
a MLGL object containing:
lambda values
intercept values for lambda
A list containing the values of estimated coefficients for each values of lambda
A list containing the index of selected variables for each values of lambda
A list containing the values index of selected groups for each values of lambda
A vector containing the number of non zero coefficients for each values of lambda
A vector containing the number of non zero groups for each values of lambda
A list containing 3 vectors. var: all variables used. group: associated groups. weight: weight associated with the different groups. level: for each group, the corresponding level of the hierarchy where it appears and disappears. 3 indicates the level with a partition of 3 groups.
computation time
dimension of X
Output of hierarchical clustering
Code executed by user
Quentin Grimonprez
cv.MLGL, stability.MLGL, listToMatrix, predict.MLGL, coef.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 MLGL method
res <- MLGL(X, y)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.