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
we first compute a soft-thresholded sample covariance matrix
The resulting algorithm has parallel complexity
and is designed for graphical lasso problems in which
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.
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.
For centered samples, the sample covariance is
threshCov soft-thresholds the off-diagonal entries to obtain
while retaining the diagonal entries.
FastMDMC then solves the sparse maximum-determinant problem
subject to
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.
fastmdmc.m— Newton–CG solver for maximum-determinant matrix completion.threshCov.m— computes the soft-thresholded sample covariance directly from ann x Nsample 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
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.