Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sandialabs/pyttb
Python Tensor Toolbox
https://github.com/sandialabs/pyttb
cp-decomposition data-science python scr-2671 snl-data-analysis tensors tucker-decomposition
Last synced: 4 days ago
JSON representation
Python Tensor Toolbox
- Host: GitHub
- URL: https://github.com/sandialabs/pyttb
- Owner: sandialabs
- License: bsd-2-clause
- Created: 2022-05-10T03:21:22.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-11T21:54:15.000Z (5 days ago)
- Last Synced: 2024-11-11T22:11:38.803Z (5 days ago)
- Topics: cp-decomposition, data-science, python, scr-2671, snl-data-analysis, tensors, tucker-decomposition
- Language: Python
- Homepage: https://pyttb.readthedocs.io
- Size: 875 KB
- Stars: 25
- Watchers: 3
- Forks: 13
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Citation: CITATION.bib
Awesome Lists containing this project
README
```
Copyright 2024 National Technology & Engineering Solutions of Sandia,
LLC (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the
U.S. Government retains certain rights in this software.
```
[![Regression tests](https://github.com/sandialabs/pyttb/actions/workflows/regression-tests.yml/badge.svg)](https://github.com/sandialabs/pyttb/actions/workflows/regression-tests.yml)
[![Coverage Status](https://coveralls.io/repos/github/sandialabs/pyttb/badge.svg)](https://coveralls.io/github/sandialabs/pyttb)
[![pypi package](https://img.shields.io/pypi/v/pyttb?label=pypi%20package)](https://pypi.org/project/pyttb/)
[![image](https://img.shields.io/pypi/pyversions/pyttb.svg)](https://pypi.python.org/pypi/pyttb)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)# pyttb: Python Tensor Toolbox
Welcome to `pyttb`, a refactor of the
[Tensor Toolbox for MATLAB](https://www.tensortoolbox.org) in Python.This package contains data classes and methods for manipulating dense,
sparse, and structured tensors, along with algorithms for computing
low-rank tensor decompositions:- Data Classes:
[`tensor`](https://pyttb.readthedocs.io/en/stable/tensor.html "dense tensors"),
[`sptensor`](https://pyttb.readthedocs.io/en/stable/sptensor.html "sparse tensors"),
[`ktensor`](https://pyttb.readthedocs.io/en/stable/ktensor.html "Kruskal tensors"),
[`ttensor`](https://pyttb.readthedocs.io/en/stable/ttensor.html "Tucker tensors"),
[`tenmat`](https://pyttb.readthedocs.io/en/stable/tenmat.html "matricized dense tensors"),
[`sptenmat`](https://pyttb.readthedocs.io/en/stable/sptenmat.html "matricized sparse tensors"),
[`sumtensor`](https://pyttb.readthedocs.io/en/stable/sumtensor.html "implicit sum of tensors")
- Algorithms:
[`cp_als`](https://pyttb.readthedocs.io/en/stable/cpals.html "CP decomposition via Alternating Least Squares"),
[`cp_apr`](https://pyttb.readthedocs.io/en/stable/cpapr.html "CP decomposition via Alternating Poisson Regression"),
[`gcp_opt`](https://pyttb.readthedocs.io/en/stable/gcpopt.html "Generalized CP decomposition"),
[`hosvd`](https://pyttb.readthedocs.io/en/stable/hosvd.html "Tucker decomposition via Higher Order Singular Value Decomposition"),
[`tucker_als`](https://pyttb.readthedocs.io/en/stable/tuckerals.html "Tucker decompostion via Alternating Least Squares")## Quick Start
### Installation
```commandline
python3 -m pip install pyttb
```### Example
```python
>>> import pyttb as ttb
>>> X = ttb.tenrand((2,2,2))
>>> type(X)>>> M = ttb.cp_als(X, rank=1)
CP_ALS:
Iter 0: f = 7.367245e-01 f-delta = 7.4e-01
Iter 1: f = 7.503069e-01 f-delta = 1.4e-02
Iter 2: f = 7.508240e-01 f-delta = 5.2e-04
Iter 3: f = 7.508253e-01 f-delta = 1.3e-06
Final f = 7.508253e-01
```### Getting Help
- [Documentation](https://pyttb.readthedocs.io)
- [Tutorials](https://pyttb.readthedocs.io/en/stable/tutorials.html)
- [Info for users coming from MATLAB](https://pyttb.readthedocs.io/en/stable/for_matlab_users.html)
- Learn about tensor decompositions:
[tensor paper](https://doi.org/10.1137/07070111X "Tensor Decompositions and Applications by Tamara G. Kolda, Brett W. Bader"),
[tensor book](https://www.mathsci.ai/post/tensor-textbook/ "Tensor Decompositions for Data Science by Grey Balard and Tamara G. Kolda")### Contributing
- [Report a bug](https://github.com/sandialabs/pyttb/issues/new)
- [Guide for contributors](CONTRIBUTING.md)
- [List of contributors](CONTRIBUTORS.md)### Citing pyttb in your work
If you use pyttb in your work, please cite it using the citation info [here](CITATION.bib).