Skip to main content

REGAIN (Regularised Graph Inference)

Project description

develstat covdevel licence PyPI Conda Python27 Python34 Requirements Status

regain

Regularised graph inference across multiple time stamps, considering the influence of latent variables. It inherits functionalities from the scikit-learn package.

Getting started

Dependencies

regain requires:

  • Python (>= 2.7 or >= 3.5)
  • NumPy (>= 1.8.2)
  • scikit-learn (>= 0.17)

You can install (required) dependencies by running:

pip install -r requirements.txt

To use the parameter selection via gaussian process optimisation, skopt is required.

Installation

The simplest way to install regain is using pip

pip install regain

or conda

conda install -c fdtomasi regain

If you'd like to install from source, or want to contribute to the project (e.g. by sending pull requests via github), read on. Clone the repository in GitHub and add it to your $PYTHONPATH.

git clone https://github.com/fdtomasi/regain.git
cd regain
python setup.py develop

Quickstart

A simple example for how to use LTGL.

import numpy as np
from regain.covariance import LatentTimeGraphLasso
from regain.datasets import make_dataset
from regain.utils import error_norm_time

np.random.seed(42)
data = make_dataset(n_dim_lat=1, n_dim_obs=10)
X = data.data
theta = data.thetas

mdl = LatentTimeGraphLasso(max_iter=50).fit(X)
print("Error: %.2f" % error_norm_time(theta, mdl.precision_))

Note that the input of LatentTimeGraphLasso is a three-dimensional matrix with shape (n_times, n_samples, n_dimensions). If you have a single time (n_times = 1), ensure a X = X.reshape(1, *X.shape) before using LatentTimeGraphLasso, or, alternatively, use LatentGraphLasso.

Citation

@ARTICLE{2018arXiv180203987T,
   author = {{Tomasi}, F. and {Tozzo}, V. and {Salzo}, S. and {Verri}, A.},
    title = "{Latent variable time-varying network inference}",
  journal = {ArXiv e-prints},
archivePrefix = "arXiv",
   eprint = {1802.03987},
 primaryClass = "stat.ML",
 keywords = {Statistics - Machine Learning, Computer Science - Learning},
     year = 2018,
    month = feb,
   adsurl = {http://adsabs.harvard.edu/abs/2018arXiv180203987T},
  adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

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

regain-0.1.2.tar.gz (60.2 kB view hashes)

Uploaded Source

Built Distribution

regain-0.1.2-py2.py3-none-any.whl (92.3 kB view hashes)

Uploaded Python 2 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