![build](https://github.com/fdtomasi/regain/actions/workflows/python-package.yml/badge.svg)
[![codecov](https://codecov.io/gh/fdtomasi/regain/branch/master/graph/badge.svg?token=1eLrec0OsI)](https://codecov.io/gh/fdtomasi/regain) [![licence](https://img.shields.io/badge/licence-BSD-blue.svg)](http://opensource.org/licenses/BSD-3-Clause) [![PyPI](https://img.shields.io/pypi/v/regain.svg)](https://pypi.python.org/pypi/regain) [![Conda](https://img.shields.io/conda/v/fdtomasi/regain.svg)](https://anaconda.org/fdtomasi/regain)
# regain
Regularised graph inference across multiple time stamps, considering the influence of latent variables.
It inherits functionalities from the [scikit-learn](https://github.com/scikit-learn/scikit-learn) package.
## Getting started
### Dependencies
`REGAIN` requires:
- Python (>= 3.6)
- NumPy (>= 1.8.2)
- scikit-learn (>= 0.17)
You can install (required) dependencies by running:
```bash
pip install -r requirements.txt
```
To use the parameter selection via gaussian process optimisation, [skopt](https://scikit-optimize.github.io/) is required.
### Installation
The simplest way to install regain is using pip
```bash
pip install regain
```
or `conda`
```bash
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.
```bash
git clone https://github.com/fdtomasi/regain.git
cd regain
python setup.py develop
```
## Quickstart
A simple example for how to use LTGL.
```python
import numpy as np
from regain.covariance import LatentTimeGraphicalLasso
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=3)
X = data.X
y = data.y
theta = data.thetas
mdl = LatentTimeGraphicalLasso(max_iter=50).fit(X, y)
print("Error: %.2f" % error_norm_time(theta, mdl.precision_))
```
**IMPORTANT**
We moved the API to be more consistent with `scikit-learn`.
Now the input of `LatentTimeGraphicalLasso` is a two-dimensional matrix `X` with shape `(n_samples, n_dimensions)`, where the belonging of samples to a different index (for example, a different time point) is indicated in `y`.
## Citation
`REGAIN` appeared in the following two publications.
For the `LatentTimeGraphicalLasso` please use
```latex
@inproceedings{Tomasi:2018:LVT:3219819.3220121,
author = {Tomasi, Federico and Tozzo, Veronica and Salzo, Saverio and Verri, Alessandro},
title = {Latent Variable Time-varying Network Inference},
booktitle = {Proceedings of the 24th ACM SIGKDD International Conference on Knowledge Discovery \&\#38; Data Mining},
series = {KDD '18},
year = {2018},
isbn = {978-1-4503-5552-0},
location = {London, United Kingdom},
pages = {2338--2346},
numpages = {9},
url = {http://doi.acm.org/10.1145/3219819.3220121},
doi = {10.1145/3219819.3220121},
acmid = {3220121},
publisher = {ACM},
address = {New York, NY, USA},
keywords = {convex optimization, graphical models, latent variables, network inference, time-series},
}
```
and for the `TimeGraphicalLassoForwardBackward` plase use
```latex
@InProceedings{pmlr-v72-tomasi18a,
title = {Forward-Backward Splitting for Time-Varying Graphical Models},
author = {Tomasi, Federico and Tozzo, Veronica and Verri, Alessandro and Salzo, Saverio},
booktitle = {Proceedings of the Ninth International Conference on Probabilistic Graphical Models},
pages = {475--486},
year = {2018},
editor = {Kratochv\'{i}l, V\'{a}clav and Studen\'{y}, Milan},
volume = {72},
series = {Proceedings of Machine Learning Research},
address = {Prague, Czech Republic},
month = {11--14 Sep},
publisher = {PMLR},
pdf = {http://proceedings.mlr.press/v72/tomasi18a/tomasi18a.pdf},
url = {http://proceedings.mlr.press/v72/tomasi18a.html},
abstract = {Gaussian graphical models have received much attention in the last years, due to their flexibility and expression power. However, the optimisation of such complex models suffer from computational issues both in terms of convergence rates and memory requirements. Here, we present a forward-backward splitting (FBS) procedure for Gaussian graphical modelling of multivariate time-series which relies on recent theoretical studies ensuring convergence under mild assumptions. Our experiments show that a FBS-based implementation achieves, with very fast convergence rates, optimal results with respect to ground truth and standard methods for dynamical network inference. Optimisation algorithms which are usually exploited for network inference suffer from drawbacks when considering large sets of unknowns. Particularly for increasing data sets and model complexity, we argue for the use of fast and theoretically sound optimisation algorithms to be significant to the graphical modelling community.}
}
```
Raw data
{
"_id": null,
"home_page": "https://github.com/fdtomasi/regain",
"name": "regain",
"maintainer": "Federico Tomasi",
"docs_url": null,
"requires_python": "",
"maintainer_email": "fdtomasi@gmail.com",
"keywords": "graph inference,latent variables",
"author": "Federico Tomasi",
"author_email": "fdtomasi@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/8b/3b/8f0e3a5a6b7564b1faf0e0d41990f1267e06932aa1d45943f60d17887cc0/regain-0.3.9.tar.gz",
"platform": null,
"description": "![build](https://github.com/fdtomasi/regain/actions/workflows/python-package.yml/badge.svg)\n[![codecov](https://codecov.io/gh/fdtomasi/regain/branch/master/graph/badge.svg?token=1eLrec0OsI)](https://codecov.io/gh/fdtomasi/regain) [![licence](https://img.shields.io/badge/licence-BSD-blue.svg)](http://opensource.org/licenses/BSD-3-Clause) [![PyPI](https://img.shields.io/pypi/v/regain.svg)](https://pypi.python.org/pypi/regain) [![Conda](https://img.shields.io/conda/v/fdtomasi/regain.svg)](https://anaconda.org/fdtomasi/regain)\n\n# regain\nRegularised graph inference across multiple time stamps, considering the influence of latent variables.\nIt inherits functionalities from the [scikit-learn](https://github.com/scikit-learn/scikit-learn) package.\n\n## Getting started\n### Dependencies\n`REGAIN` requires:\n- Python (>= 3.6)\n- NumPy (>= 1.8.2)\n- scikit-learn (>= 0.17)\n\nYou can install (required) dependencies by running:\n```bash\npip install -r requirements.txt\n```\n\nTo use the parameter selection via gaussian process optimisation, [skopt](https://scikit-optimize.github.io/) is required.\n\n### Installation\nThe simplest way to install regain is using pip\n```bash\npip install regain\n```\nor `conda`\n\n```bash\nconda install -c fdtomasi regain\n```\n\nIf 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.\n```bash\ngit clone https://github.com/fdtomasi/regain.git\ncd regain\npython setup.py develop\n```\n\n## Quickstart\nA simple example for how to use LTGL.\n```python\nimport numpy as np\nfrom regain.covariance import LatentTimeGraphicalLasso\nfrom regain.datasets import make_dataset\nfrom regain.utils import error_norm_time\n\nnp.random.seed(42)\ndata = make_dataset(n_dim_lat=1, n_dim_obs=3)\nX = data.X\ny = data.y\ntheta = data.thetas\n\nmdl = LatentTimeGraphicalLasso(max_iter=50).fit(X, y)\nprint(\"Error: %.2f\" % error_norm_time(theta, mdl.precision_))\n```\n**IMPORTANT**\nWe moved the API to be more consistent with `scikit-learn`.\nNow the input of `LatentTimeGraphicalLasso` is a two-dimensional matrix `X` with shape `(n_samples, n_dimensions)`, where the belonging of samples to a different index (for example, a different time point) is indicated in `y`.\n\n\n## Citation\n\n`REGAIN` appeared in the following two publications.\nFor the `LatentTimeGraphicalLasso` please use\n\n```latex\n@inproceedings{Tomasi:2018:LVT:3219819.3220121,\n author = {Tomasi, Federico and Tozzo, Veronica and Salzo, Saverio and Verri, Alessandro},\n title = {Latent Variable Time-varying Network Inference},\n booktitle = {Proceedings of the 24th ACM SIGKDD International Conference on Knowledge Discovery \\&\\#38; Data Mining},\n series = {KDD '18},\n year = {2018},\n isbn = {978-1-4503-5552-0},\n location = {London, United Kingdom},\n pages = {2338--2346},\n numpages = {9},\n url = {http://doi.acm.org/10.1145/3219819.3220121},\n doi = {10.1145/3219819.3220121},\n acmid = {3220121},\n publisher = {ACM},\n address = {New York, NY, USA},\n keywords = {convex optimization, graphical models, latent variables, network inference, time-series},\n} \n```\n\nand for the `TimeGraphicalLassoForwardBackward` plase use\n\n```latex\n@InProceedings{pmlr-v72-tomasi18a,\n title = \t {Forward-Backward Splitting for Time-Varying Graphical Models},\n author = \t {Tomasi, Federico and Tozzo, Veronica and Verri, Alessandro and Salzo, Saverio},\n booktitle = \t {Proceedings of the Ninth International Conference on Probabilistic Graphical Models},\n pages = \t {475--486},\n year = \t {2018},\n editor = \t {Kratochv\\'{i}l, V\\'{a}clav and Studen\\'{y}, Milan},\n volume = \t {72},\n series = \t {Proceedings of Machine Learning Research},\n address = \t {Prague, Czech Republic},\n month = \t {11--14 Sep},\n publisher = \t {PMLR},\n pdf = \t {http://proceedings.mlr.press/v72/tomasi18a/tomasi18a.pdf},\n url = \t {http://proceedings.mlr.press/v72/tomasi18a.html},\n abstract = \t {Gaussian graphical models have received much attention in the last years, due to their flexibility and expression power. However, the optimisation of such complex models suffer from computational issues both in terms of convergence rates and memory requirements. Here, we present a forward-backward splitting (FBS) procedure for Gaussian graphical modelling of multivariate time-series which relies on recent theoretical studies ensuring convergence under mild assumptions. Our experiments show that a FBS-based implementation achieves, with very fast convergence rates, optimal results with respect to ground truth and standard methods for dynamical network inference. Optimisation algorithms which are usually exploited for network inference suffer from drawbacks when considering large sets of unknowns. Particularly for increasing data sets and model complexity, we argue for the use of fast and theoretically sound optimisation algorithms to be significant to the graphical modelling community.}\n}\n```\n",
"bugtrack_url": null,
"license": "FreeBSD",
"summary": "REGAIN (Regularised Graph Inference)",
"version": "0.3.9",
"project_urls": {
"Download": "https://github.com/fdtomasi/regain/archive/v0.3.9.tar.gz",
"Homepage": "https://github.com/fdtomasi/regain"
},
"split_keywords": [
"graph inference",
"latent variables"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "171e5be2043a25203684126d10c87743f52b953e6eae9f0adaf62903b36db4c7",
"md5": "d33a92717db79ef0a997ae72cd4fa713",
"sha256": "756b685d27f19b2940fcf97044633ffb2e13fc640f5acc7e3807e59c72e349b1"
},
"downloads": -1,
"filename": "regain-0.3.9-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "d33a92717db79ef0a997ae72cd4fa713",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 197097,
"upload_time": "2023-07-04T09:26:37",
"upload_time_iso_8601": "2023-07-04T09:26:37.158966Z",
"url": "https://files.pythonhosted.org/packages/17/1e/5be2043a25203684126d10c87743f52b953e6eae9f0adaf62903b36db4c7/regain-0.3.9-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8b3b8f0e3a5a6b7564b1faf0e0d41990f1267e06932aa1d45943f60d17887cc0",
"md5": "f8356813860ac32cf293023903d14396",
"sha256": "da65dcdc8c78fafed027c23fc93bcf2df5f5feb75786e5e7a8f455868f2d7431"
},
"downloads": -1,
"filename": "regain-0.3.9.tar.gz",
"has_sig": false,
"md5_digest": "f8356813860ac32cf293023903d14396",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 110007,
"upload_time": "2023-07-04T09:26:38",
"upload_time_iso_8601": "2023-07-04T09:26:38.812023Z",
"url": "https://files.pythonhosted.org/packages/8b/3b/8f0e3a5a6b7564b1faf0e0d41990f1267e06932aa1d45943f60d17887cc0/regain-0.3.9.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-04 09:26:38",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "fdtomasi",
"github_project": "regain",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "regain"
}