overlapgglasso {MLGL}R Documentation

Group-lasso with overlapping groups

Description

Group-lasso with overlapping groups

Usage

overlapgglasso(
  X,
  y,
  var,
  group,
  lambda = NULL,
  weight = NULL,
  loss = c("ls", "logit"),
  intercept = TRUE,
  ...
)

Arguments

X

matrix of size n*p

y

vector of size n. If loss = "logit", elements of y must be in -1,1

var

vector containing the variable to use

group

vector containing the associated groups

lambda

lambda values for group lasso. If not provided, the function generates its own values of lambda

weight

a vector the weight for each group. Default is the square root of the size of each group

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 ?

...

Others parameters for gglasso function

Details

Use a group-lasso algorithm (see gglasso) to solve a group-lasso with overlapping groups. Each variable j of the original matrix X is paste k(j) times in a new dataset with k(j) the number of different groups containing the variable j. The new dataset is used to solve the group-lasso with overlapping groups running a group-lasso algorithm.

Value

a MLGL object containing:

lambda

lambda values

b0

intercept values for lambda

beta

A list containing the values of estimated coefficients for each values of lambda

var

A list containing the index of selected variables for each values of lambda

group

A list containing the values index of selected groups for each values of lambda

nVar

A vector containing the number of non zero coefficients for each values of lambda

nGroup

A vector containing the number of non zero groups for each values of lambda

structure

A list containing 3 vectors. var: all variables used. group: associated groups. weight: weight associated with the different groups.

time

computation time

dim

dimension of X

Source

Laurent Jacob, Guillaume Obozinski, and Jean-Philippe Vert. 2009. Group lasso with overlap and graph lasso. In Proceedings of the 26th Annual International Conference on Machine Learning (ICML '09).

See Also

listToMatrix

Examples

# Least square loss
set.seed(42)
X <- simuBlockGaussian(50, 12, 5, 0.7)
y <- X[, c(2, 7, 12)] %*% c(2, 2, -2) + rnorm(50, 0, 0.5)
var <- c(1:60, 1:8, 7:15)
group <- c(rep(1:12, each = 5), rep(13, 8), rep(14, 9))
res <- overlapgglasso(X, y, var, group)

# Logistic loss
y <- 2 * (rowSums(X[, 1:4]) > 0) - 1
var <- c(1:60, 1:8, 7:15)
group <- c(rep(1:12, each = 5), rep(13, 8), rep(14, 9))
res <- overlapgglasso(X, y, var, group, loss = "logit")

[Package MLGL version 1.0.0 Index]