REGAIN (Regularised Graph Inference)
Project description
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for regain-0.1.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d311853e270eb107c02cfefe6d20156bf72238266ad9a64e7237f9d6714b0d0 |
|
MD5 | 0c3d2a1703530037580f1b0dfe6d5fb3 |
|
BLAKE2b-256 | 9aec3e7cddd3d21fc2ce4e984537a1435235f06317aacf2228fce3c0b67030b8 |