Generalized CP Decomposition with Tensorly
Project description
TensorLy-Gcp
TensorLy-Gcp is a Python library for fitting generalized parafac decomposition (GCP) [1] and its stochastic version (SGCP) [2] which allows using different losses rather than only Euclidean. Tensorly-Gcp builds on top of TensorLy. Both GCP and SGCP algorithms fit generalized parafac given an input tensor using a gradient-based algorithm. Gradients are computed according to a loss selected by the user, and may be provided by the user, allowing customization. While GCP implementation uses Limited-memory BFGS (LBFGS) method for optimization, SGCP uses ADAM optimization as in [2].
The following losses are implemented in Tensorly-Gcp:
Rayleigh
Bernoulli odds
Bernoulli logit
Gamma
Poisson count
Poisson log
Gaussian
Contributing
At the moment, only Numpy backend is supported to implement GCP and SGCP. This library can be compatible with other backends (Pytorch, Tensorflow, Jax, Mxnet) by improving LBFGS with the given information in here. Then, it could eventually be merged in TensorLy.
Usage
It is possible select one of the losses from the list above and fit generalized decomposition easily:
from tlgcp import generalized_parafac
rank = 3
loss = 'rayleigh'
tensorgcp, errorsgcp = generalized_parafac(tensor, rank=rank, loss=loss)
Installing TensorLy-GCP
Through pip
pip install tensorly-gcp
From source
git clone https://github.com/tensorly/gcp
cd gcp
pip install -e .
References
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 Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tensorly_gcp-0.1.0-py3.8.egg.
File metadata
- Download URL: tensorly_gcp-0.1.0-py3.8.egg
- Upload date:
- Size: 208.1 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b8b07caee870c790dedfe77d6e646702ecef542a540e1b9c7ecd0f9b62c10e3
|
|
| MD5 |
4853aeb6df4c20eaa1f71087f361fde2
|
|
| BLAKE2b-256 |
f1e38e050c4c42123ea312b1b99db66587fdf2a1faac06c54d5640d86c760057
|
File details
Details for the file tensorly_gcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: tensorly_gcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 183.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dedcf09122393efc8470df2c11dc96e8de30abf083afe5607fb643ab900dc3ce
|
|
| MD5 |
d76937e337be202f14e54c8b2564a5aa
|
|
| BLAKE2b-256 |
4eaea87b676d24d23106a5dce41d86850b368274b063e6879a01a79291af0f60
|