GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - ryz-codes/fastmdmc

BranchesTags
Open more actions menu

Latest commit

 

History

2 Commits
2 Commits

Folders and files

NameName
Last commit message
Last commit date
README.md
README.md
 
 
fastmdmc.m
fastmdmc.m
 
 
genSamp.m
genSamp.m
 
 
threshCov.m
threshCov.m
 
 

Repository files navigation

FastMDMC

Soft-Thresholding and Max-Det Matrix Completion for Graphical Lasso

FastMDMC is a MATLAB implementation of the algorithm described in our ICML 2018 paper, Large-Scale Sparse Inverse Covariance Estimation via Thresholding and Max-Det Matrix Completion.

The method recovers the graphical lasso estimator of Friedman, Hastie, and Tibshirani (2008), under the conditions described in the paper, using two stages. Given the sample matrix

$$ X=[x_1,\ldots,x_N]\in\mathbb{R}^{n\times N}, $$

we first compute a soft-thresholded sample covariance matrix $C_\lambda$. This step requires $O(n^2/p)$ time over $p$ parallel processors and can be carried out without explicitly storing the dense $n\times n$ sample covariance matrix. We then solve the associated maximum-determinant matrix completion problem using $C_\lambda$ as input. When the thresholded covariance has a sparse Cholesky factorization, this stage uses linear time and memory in $n$ for fixed solution accuracy.

The resulting algorithm has parallel complexity

$$ O(n^2/p+n) $$

and is designed for graphical lasso problems in which $n$ is too large to store or manipulate dense $n\times n$ matrices.

In the experiments reported in the paper, the MATLAB implementation solved problems with up to 200,000 variables to 7–9 digits of accuracy on a standard laptop.

Usage

Suppose X is an n x N matrix whose columns are samples. The samples should first be centered so that each row has zero mean.

X = X - mean(X, 2);

lambda = 0.1;

% Soft-threshold the sample covariance
C_lambda = threshCov(X, lambda);

% Solve the max-det matrix completion problem
[Theta, S] = fastmdmc(C_lambda);

Theta is the sparse inverse-covariance estimate. If the conditions in the paper relating soft-thresholding to graphical lasso are satisfied, Theta is the corresponding graphical lasso solution.

If the dual solution is not needed, simply use

[Theta, ~] = fastmdmc(C_lambda);

The input to fastmdmc must be a MATLAB sparse matrix.

Method

For centered samples, the sample covariance is

$$ C=\frac{1}{N}XX^T. $$

threshCov soft-thresholds the off-diagonal entries to obtain $C_\lambda$,

$$ (C_\lambda)_{ij} \mathrm{sign}(C_{ij}) \max ( |C_{ij}|-\lambda,0), \qquad i\ne j, $$

while retaining the diagonal entries.

FastMDMC then solves the sparse maximum-determinant problem

$$ \underset{\Theta\succ0}{\mathrm{minimize}} \quad \mathrm{tr}(C_\lambda\Theta)-\log\det\Theta $$

subject to

$$ \Theta_{ij}=0 \qquad\text{whenever}\qquad (C_\lambda)_{ij}=0. $$

The solver constructs a chordal embedding using approximate minimum-degree ordering and solves the resulting problem with a custom Newton–conjugate-gradient method. The implementation exploits sparse Cholesky structure throughout rather than forming dense covariance, inverse-covariance, or Newton matrices.

Files

  • fastmdmc.m — Newton–CG solver for maximum-determinant matrix completion.
  • threshCov.m — computes the soft-thresholded sample covariance directly from an n x N sample matrix, using blockwise dense matrix multiplication to avoid storing the full covariance matrix.
  • genSamp.m — generates Gaussian samples with a specified sparse positive-definite inverse covariance matrix.

For example,

X = genSamp(Theta, N);

generates N independent samples from

$$ \mathcal{N}(0,\Theta^{-1}). $$

Reference

If you use this code, please cite

Richard Y. Zhang, Salar Fattahi, and Somayeh Sojoudi. Large-Scale Sparse Inverse Covariance Estimation via Thresholding and Max-Det Matrix Completion. Proceedings of the 35th International Conference on Machine Learning, PMLR 80:5766–5775, 2018.

@inproceedings{zhang2018large,
  title     = {Large-Scale Sparse Inverse Covariance Estimation via
               Thresholding and Max-Det Matrix Completion},
  author    = {Zhang, Richard Y. and Fattahi, Salar and Sojoudi, Somayeh},
  booktitle = {Proceedings of the 35th International Conference on Machine Learning},
  series    = {Proceedings of Machine Learning Research},
  volume    = {80},
  pages     = {5766--5775},
  year      = {2018}
}

The graphical lasso estimator was introduced in

Jerome Friedman, Trevor Hastie, and Robert Tibshirani. Sparse inverse covariance estimation with the graphical lasso. Biostatistics, 9(3):432–441, 2008. DOI: 10.1093/biostatistics/kxm045.

About

No description, website, or topics provided.

Resources

Readme
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.