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.
SQUIC Python3 Interface Package
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.
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.,
Run the following command to install the library:
pip install squic
Export the variable
SQUIC_LIB_PATH with the location of the library downloaded in Step1, example:
Load the SQUIC package:
For further details type
help(squic) in the Python command line.
Note: The number of threads used by SQUIC can be defined by setting the enviroment variable OMP_NUM_THREADS (e.g.,
base> export OMP_NUM_THREADS=12). This may require a restart of the session).
To run a simple example :
import squic import numpy as np # generate sample from tridiagonal precision matrix p = 1024 n = 100 l = .4 # generate a tridiagonal matrix 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)
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.