Skip to main content

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:

SQUIC for Python

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.

Source Distribution

squic-1.0.3.tar.gz (19.8 kB view hashes)

Uploaded Source

Built Distribution

squic-1.0.3-py3-none-any.whl (20.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page