conesta {mglasso} | R Documentation |
CONESTA solver.
Description
Solve the MGLasso optimization problem using CONESTA algorithm. Interface to the pylearn.parsimony python library.
Usage
conesta(
X,
lam1,
lam2,
beta_warm = c(0),
type_ = "initial",
W_ = NULL,
mean_ = FALSE,
max_iter_ = 10000,
prec_ = 0.01
)
Arguments
X |
Data matrix nxp. |
lam1 |
Sparsity penalty. |
lam2 |
Total variation penalty. |
beta_warm |
Warm initialization vector. |
type_ |
Character scalar. By default set to initial version which doesn't use weights |
W_ |
Weights matrix for total variation penalties. |
mean_ |
Logical scalar. If TRUE weights the optimization function by the inverse of sample size. |
max_iter_ |
Numeric scalar. Maximum number of iterations. |
prec_ |
Numeric scalar. Tolerance for the stopping criterion (duality gap). |
Details
COntinuation with NEsterov smoothing in a Shrinkage-Thresholding Algorithm (CONESTA, Hadj-Selem et al. 2018) doi:10.1109/TMI.2018.2829802 is an algorithm design for solving optimization problems including group-wise penalties. This function is an interface with the python solver. The MGLasso problem is first reformulated in a problem of the form
argmin 1/2 ||Y -
\tilde{X} \tilde{\beta}||_2^2 + \lambda_1 ||\tilde{\beta}||_1 + \lambda_2
\sum_{i<j} ||\boldsymbol A_{ij} \tilde{\beta}||_2
where vector Y
is
the vectorized form of matrix X
.
Value
Numeric matrix of size pxp. Line k
of the matrix represents
the coefficients obtained from the L1-L2 penalized regression of variable
k
on the others.
See Also
mglasso()
for the MGLasso model estimation.
Examples
## Not run: # because of installation of external packages during checks
mglasso::install_pylearn_parsimony(envname = "rmglasso", method = "conda")
reticulate::use_condaenv("rmglasso", required = TRUE)
reticulate::py_config()
n = 30
K = 2
p = 4
rho = 0.85
blocs <- list()
for (j in 1:K) {
bloc <- matrix(rho, nrow = p/K, ncol = p/K)
for(i in 1:(p/K)) { bloc[i,i] <- 1 }
blocs[[j]] <- bloc
}
mat.covariance <- Matrix::bdiag(blocs)
mat.covariance
set.seed(11)
X <- mvtnorm::rmvnorm(n, mean = rep(0,p), sigma = as.matrix(mat.covariance))
X <- scale(X)
res <- conesta(X, 0.1, 0.1)
## End(Not run)