Metadata-Version: 2.1
Name: tn4ml
Version: 1.0.3
Summary: Tensor Networks for Machine Learning
Home-page: https://github.com/bsc-quantic/tn4ml/tree/master
Author: Ema Puljak, Sergio Sanchez Ramirez, Sergi Masot Llima, Jofre Vallès-Muns
License: MIT
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: autoray>=0.3.0
Requires-Dist: dask
Requires-Dist: funcy
Requires-Dist: numpy
Requires-Dist: opt_einsum
Requires-Dist: quimb>=1.4.1
Requires-Dist: jaxlib
Requires-Dist: jax
Requires-Dist: optax
Requires-Dist: flax
Requires-Dist: pandas
Requires-Dist: nevergrad
Requires-Dist: chocolate
Requires-Dist: baytune
Requires-Dist: optuna
Requires-Dist: scikit-optimize
Requires-Dist: kahypar
Provides-Extra: docs
Requires-Dist: sphinx>=2.0; extra == "docs"
Requires-Dist: sphinx-book-theme; extra == "docs"
Requires-Dist: ipykernel; extra == "docs"
Requires-Dist: nbsphinx; extra == "docs"
Requires-Dist: sphinxcontrib-bibtex; extra == "docs"
Requires-Dist: sphinxcontrib-devhelp; extra == "docs"
Requires-Dist: sphinxcontrib-htmlhelp; extra == "docs"
Requires-Dist: sphinxcontrib-jsmath; extra == "docs"
Requires-Dist: sphinxcontrib-qthelp; extra == "docs"
Requires-Dist: sphinxcontrib-serializinghtml; extra == "docs"
Requires-Dist: sphinx-rtd-theme; extra == "docs"
Requires-Dist: sphinx-copybutton; extra == "docs"
Requires-Dist: sphinx-gallery; extra == "docs"
Requires-Dist: tensorflow; extra == "docs"
Provides-Extra: test
Requires-Dist: pytest; extra == "test"

<img src="docs/_static/logo.png" position="center" alt="logo" width="500" height="200">

# Tensor Networks for Machine Learning
![Static Badge](https://img.shields.io/badge/tests-passing-blue)
![Static Badge](https://img.shields.io/badge/docs-passing-green)<br>
**tn4ml** is a Python library that handles tensor networks for machine learning applications. It is built on top of **Quimb**, for Tensor Network objects, and **JAX**, for optimization pipeline.<br>
For now, the library supports 1D Tensor Network structures: **Matrix Product State**, **Matrix Product Operator** and **Spaced Matrix Product Operator**.<br>
It supports different **embedding** functions, **initialization** techniques, and **optimization strategies**.<br>

## Installation

First create a virtualenv using `pyenv` or `conda`. Then install the package and its dependencies.
<br>

**With** `pip` (tag v1.0.2):
```bash
pip install tn4ml
```
<br>

or **directly from github**:
```bash
pip install -U git+https://github.com/bsc-quantic/tn4ml.git
```
<br>

If you want to test and edit the code, you can clone local version of the package and install.
```bash
git clone https://github.com/bsc-quantic/tn4ml.git
pip install -e tn4ml/
```
## Documentation
Visit [tn4ml.readthedocs.io](https://tn4ml.readthedocs.io/en/latest/)

## Example notebooks
There are working examples of **supervised learning** (classification), and **unsupervised learning** (anomaly detection), both on MNIST images.<br>

[TN for Classification](docs/source/notebooks/mnist_classification.ipynb)<br>
[TN for Anomaly Detection](docs/source/notebooks/mnist_ad.ipynb)<br>
[TN for Anomaly Detection with DMRG-like method](docs/source/notebooks/mnist_ad_sweeps.ipynb)

## License
MIT license - check it out [here](LICENSE)
