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 library $\mathtt{libSQUIC}$ from here, and follow its README instructions. The default and recommended location for $\mathtt{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

Use export SQUIC_LIB_PATH=/path/to/squic/, replacing /path/to/squic/ with the path of where $\mathtt{libSQUIC}$ can be found. If this variable is not set, the default location of $\mathtt{libSQUIC}$ is $HOME. This should be done before calling Python.

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) or check the User Manual.

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.4.tar.gz (19.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

squic-1.0.4-py3-none-any.whl (19.9 kB view details)

Uploaded Python 3

File details

Details for the file squic-1.0.4.tar.gz.

File metadata

  • Download URL: squic-1.0.4.tar.gz
  • Upload date:
  • Size: 19.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for squic-1.0.4.tar.gz
Algorithm Hash digest
SHA256 b162e5742eb9a5a86fa301f4cc1feeb4c3d61afb58e86edbe0313df7e6a3d1cb
MD5 37fe23b532ccc78e0a6dd3301e15bdea
BLAKE2b-256 b2a995f00cc20df8f5a871cd43e4bd3e68db8a0c8ce815c51b04e30dc9b5b2eb

See more details on using hashes here.

File details

Details for the file squic-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: squic-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 19.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for squic-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 567912396d3073663f631877437a1befc15428af1d05536c871e6c4411ef93ae
MD5 042c41fad7ef70e8bbdf748cb7934659
BLAKE2b-256 24f849797608485ae8b6d89f6258a2f11f7ba69feff0d0373d5800601c48e80c

See more details on using hashes here.

Supported by

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