mglasso
Inference of multiscale graphical models with neighborhood selection approach
Science Score: 33.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
○codemeta.json file
-
○.zenodo.json file
-
✓DOI references
Found 2 DOI reference(s) in README -
✓Academic publication links
Links to: arxiv.org -
✓Committers with academic emails
1 of 3 committers (33.3%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (15.6%) to scientific vocabulary
Last synced: 10 months ago
·
JSON representation
Repository
Inference of multiscale graphical models with neighborhood selection approach
Basic Info
- Host: GitHub
- Owner: desanou
- License: other
- Language: R
- Default Branch: master
- Homepage: https://desanou.github.io/mglasso/
- Size: 3.23 MB
Statistics
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
- Releases: 0
Created almost 5 years ago
· Last pushed about 3 years ago
Metadata Files
Readme
License
README.Rmd
---
output: github_document
---
[](https://github.com/desanou/mglasso/actions/workflows/basic.yml)
[](https://www.repostatus.org/#active)
[](https://lifecycle.r-lib.org/articles/stages.html#maturing-1)
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
out.width = "100%"
)
```
## Method
This repository provides an implementation of the `MGLasso` (Multiscale Graphical Lasso) algorithm: an approach for estimating sparse Gaussian Graphical Models with the addition of a group-fused Lasso penalty.
`MGLasso` is described in the paper [Inference of Multiscale Gaussian Graphical Model](https://desanou.github.io/multiscale_glasso/). `MGLasso` has these contributions:
- We simultaneously infer a network and estimate a clustering structure by combining the [neighborhood selection](https://arxiv.org/abs/math/0608017) approach (Meinshausen and Bühlman, 2006) and [convex clustering](https://www.di.ens.fr/~fbach/419_icmlpaper.pdf) (Hocking et al. 2011).
- We use a continuation with Nesterov smoothing in a shrinkage-thresholding algorithm ([`CONESTA`](https://arxiv.org/abs/1605.09658), Hadj-Selem et al. 2018) to solve the optimization problem.
To solve the `MGLasso` problem, we seek the regression vectors $\beta^i$ that minimize
$J_{\lambda_1, \lambda_2}(\boldsymbol{\beta}; \mathbf{X} ) =
\frac{1}{2}
\sum_{i=1}^p
\left \lVert
\mathbf{X}^i - \mathbf{X}^{\setminus i} \boldsymbol{\beta}^i
\right \rVert_2 ^2 +
\lambda_1
\sum_{i = 1}^p
\left \lVert
\boldsymbol{\beta}^i \right \rVert_1 +
\lambda_2
\sum_{i < j}
\left \lVert
\boldsymbol{\beta}^i - \tau_{ij}(\boldsymbol{\beta}^j)
\right \rVert_2.$
`MGLasso` package is based on the python implementation of the solver `CONESTA` available in [pylearn-parsimony](https://github.com/neurospin/pylearn-parsimony) library.
## Package requirements and installation
- Install the `reticulate` package and Miniconda if no conda distribution available on the OS.
```{r eval = FALSE}
install.packages('reticulate')
reticulate::install_miniconda()
```
- Install `MGLasso`, its python dependencies and configure the conda environment `rmglasso`.
```{r eval = FALSE}
# install.packages('mglasso')
remotes::install_github("desanou/mglasso")
```
```{r}
library(mglasso)
install_pylearn_parsimony(envname = "rmglasso", method = "conda")
reticulate::use_condaenv("rmglasso", required = TRUE)
reticulate::py_config()
```
The `conesta_solver` is delay loaded. See `reticulate::import_from_path` for details.
An example of use is given below.
## Illustration on a simple model
### Simulate a block diagonal model
We simulate a $3$-block diagonal model where each block contains $3$ variables. The intra-block correlation level is set to $0.85$ while the correlations outside the blocks are kept to $0$.
```{r }
library(Matrix)
n = 50
K = 3
p = 9
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.correlation <- Matrix::bdiag(blocs)
corrplot::corrplot(as.matrix(mat.correlation), method = "color", tl.col="black")
```
#### Simulate gaussian data from the covariance matrix
```{r }
set.seed(11)
X <- mvtnorm::rmvnorm(n, mean = rep(0,p), sigma = as.matrix(mat.correlation))
colnames(X) <- LETTERS[1:9]
```
### Run `mglasso()`
We set the sparsity level $\lambda_1$ to $0.2$ and rescaled it with the size of the sample.
```{r }
X <- scale(X)
res <- mglasso(X, lambda1 = 0.2*n, lambda2_start = 0.1, fuse_thresh = 1e-3, verbose = FALSE)
```
To launch a unique run of the objective function call the `conesta` function.
```{r}
temp <- mglasso::conesta(X, lam1 = 0.2*n, lam2 = 0.1)
```
#### Estimated clustering path
We plot the clustering path of `mglasso` method on the 2 principal components axis of $X$. The path is drawn on the predicted $X$'s.
```{r}
library(ggplot2)
library(ggrepel)
mglasso:::plot_clusterpath(as.matrix(X), res)
```
#### Estimated adjacency matrices along the clustering path
As the the fusion penalty increases from `level9` to `level1` we observe a progressive fusion of adjacent edges.
```{r}
plot_mglasso(res)
```
## Reference
Edmond, Sanou; Christophe, Ambroise; Geneviève, Robin; (2022): Inference of Multiscale Gaussian Graphical Model. ArXiv. Preprint.
Owner
- Name: desanou
- Login: desanou
- Kind: user
- Repositories: 15
- Profile: https://github.com/desanou
GitHub Events
Total
Last Year
Committers
Last synced: over 2 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| Edmond Sanou | 4****u | 229 |
| Edmond S | d****u@g****m | 65 |
| Edmond Sanou | d****u@u****r | 19 |
Committer Domains (Top 20 + Academic)
univ-evry.fr: 1
Issues and Pull Requests
Last synced: over 2 years ago
All Time
- Total issues: 1
- Total pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: 17 minutes
- Total issue authors: 1
- Total pull request authors: 1
- Average comments per issue: 2.0
- Average comments per pull request: 0.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 1
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 1
- Pull request authors: 0
- Average comments per issue: 2.0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- pneuvial (1)
Pull Request Authors
- desanou (1)
- olivroy (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- cran 213 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 2
- Total maintainers: 1
cran.r-project.org: mglasso
Multiscale Graphical Lasso
- Homepage: https://desanou.github.io/mglasso/
- Documentation: http://cran.r-project.org/web/packages/mglasso/mglasso.pdf
- License: MIT + file LICENSE
- Status: removed
-
Latest release: 0.1.2
published almost 4 years ago
Rankings
Stargazers count: 28.5%
Forks count: 28.8%
Dependent packages count: 29.8%
Dependent repos count: 35.5%
Average: 38.8%
Downloads: 71.5%
Maintainers (1)
Last synced:
over 2 years ago
Dependencies
DESCRIPTION
cran
- Matrix * imports
- R.utils * imports
- corpcor * imports
- ggplot2 * imports
- ggrepel * imports
- gridExtra * imports
- methods * imports
- reticulate >= 1.25 imports
- rstudioapi * imports
- knitr * suggests
- mvtnorm * suggests
- rmarkdown * suggests
- testthat >= 3.0.0 suggests