SQUIC is a second-order, L1-regularized maximum likelihood method for performant large-scale sparse precision matrix estimation. This repository contains the source code for the Python interface of SQUIC.
Project description
SQUIC for Python
SQUIC is a second-order, L1-regularized maximum likelihood method for performant large-scale sparse precision matrix estimation. This repository contains the source code for the Python(v3) interface of SQUIC.
For an interactive session using SQUIC for Python, see Google Colab:
Installation
Step 1:
Download the shared library libSQUIC
from www.gitlab.ci.inf.usi.ch/SQUIC/libSQUIC, and follow its README instructions. The default and recommended location for libSQUIC
is the home directory, i.e., ~/
. Note that precompiled versions are available.
Step 2:
Run the following command to install the library:
pip3 install squic
Note: The environment variable SQUIC_LIB_PATH
defines the location of libSQUIC
- this is by default set to the home directory of the user. If this is not the location of libSQUIC
, it can be changed via terminal bash> export SQUIC_LIB_PATH=/path/to/squic/
Example
In this example, we will use SQUIC to estimate the precision matrix of a synthetically generated dataset with correlated random variables, where the true precision matrix is tridiagonal.
import squic
import numpy as np
# generate sample from tridiagonal precision matrix
p = 1024
n = 100
l = .4
# generate a tridiagonal matrix
np.random.seed(1)
a = -0.5 * np.ones(p-1)
b = 1.25 * np.ones(p)
iC_star = np.diag(a,-1) + np.diag(b,0) + np.diag(a,1)
# generate the data
L = np.linalg.cholesky(iC_star)
Y = np.linalg.solve(L.T,np.random.randn(p,n))
[X,W,info_times,info_objective,info_logdetX,info_trSX] = squic.run(Y,l)
For further details type help(SQUIC)
.
Publications & References
Please cite our publications if it helps your research:
@article{X,
author = {X},
title = {X}
journal = {X}
volume = {X}
number = {X}
pages = {X}
year = {X}
doi = {X}
}
For related research on SQUIC please see:
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.