All Projects → rballester → Tntorch

rballester / Tntorch

Licence: lgpl-3.0
Tensor Network Learning with PyTorch

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Tntorch

Data Science Resources
👨🏽‍🏫You can learn about what data science is and why it's important in today's modern world. Are you interested in data science?🔋
Stars: ✭ 171 (+28.57%)
Mutual labels:  data-science, learning
Virgilio
Virgilio is developed and maintained by these awesome people. You can email us virgilio.datascience (at) gmail.com or join the Discord chat.
Stars: ✭ 13,200 (+9824.81%)
Mutual labels:  data-science, learning
Py Rse
Research Software Engineering with Python course material
Stars: ✭ 145 (+9.02%)
Mutual labels:  data-science, learning
Uci Ml Api
Simple API for UCI Machine Learning Dataset Repository (search, download, analyze)
Stars: ✭ 190 (+42.86%)
Mutual labels:  data-science, learning
Learn Something Every Day
📝 A compilation of everything that I learn; Computer Science, Software Development, Engineering, Math, and Coding in General. Read the rendered results here ->
Stars: ✭ 362 (+172.18%)
Mutual labels:  data-science, learning
Danfojs
danfo.js is an open source, JavaScript library providing high performance, intuitive, and easy to use data structures for manipulating and processing structured data.
Stars: ✭ 1,304 (+880.45%)
Mutual labels:  data-science, tensors
Awesome Computer Science Opportunities
An awesome list of events and fellowship opportunities for Computer Science students
Stars: ✭ 2,445 (+1738.35%)
Mutual labels:  data-science, learning
Data Science Live Book
An open source book to learn data science, data analysis and machine learning, suitable for all ages!
Stars: ✭ 193 (+45.11%)
Mutual labels:  data-science, learning
Learningx
Deep & Classical Reinforcement Learning + Machine Learning Examples in Python
Stars: ✭ 241 (+81.2%)
Mutual labels:  data-science, learning
Learn Julia The Hard Way
Learn Julia the hard way!
Stars: ✭ 679 (+410.53%)
Mutual labels:  data-science, learning
Dive Into Machine Learning
Dive into Machine Learning with Python Jupyter notebook and scikit-learn! First posted in 2016, maintained as of 2021. Pull requests welcome.
Stars: ✭ 10,810 (+8027.82%)
Mutual labels:  data-science, learning
Datascicomp
A collection of popular Data Science Challenges/Competitions || Countdown timers to keep track of the entry deadlines.
Stars: ✭ 1,636 (+1130.08%)
Mutual labels:  data-science
Griffon Vm
Griffon Data Science Virtual Machine
Stars: ✭ 128 (-3.76%)
Mutual labels:  data-science
Torchbear
🔥🐻 The Speakeasy Scripting Engine Which Combines Speed, Safety, and Simplicity
Stars: ✭ 128 (-3.76%)
Mutual labels:  data-science
Web Development Resources
A list of useful resources for Web Developers! Put it in your bookmarks and contribute something ❤️
Stars: ✭ 128 (-3.76%)
Mutual labels:  learning
Seq2seq tutorial
Code For Medium Article "How To Create Data Products That Are Magical Using Sequence-to-Sequence Models"
Stars: ✭ 132 (-0.75%)
Mutual labels:  data-science
Binarytree
Python Library for Studying Binary Trees
Stars: ✭ 1,694 (+1173.68%)
Mutual labels:  learning
Dtale Desktop
Build a data visualization dashboard with simple snippets of python code
Stars: ✭ 128 (-3.76%)
Mutual labels:  data-science
Lifelines
Survival analysis in Python
Stars: ✭ 1,766 (+1227.82%)
Mutual labels:  data-science
Awesome Scientific Python
A curated list of awesome scientific Python resources
Stars: ✭ 127 (-4.51%)
Mutual labels:  data-science

Documentation Status

tntorch - Tensor Network Learning with PyTorch

Read the Docs site: http://tntorch.readthedocs.io/

Welcome to tntorch, a PyTorch-powered modeling and learning library using tensor networks. Such networks are unique in that they use multilinear neural units (instead of non-linear activation units). Features include:

  • Basic and fancy indexing of tensors, broadcasting, assignment, etc.
  • Tensor decomposition and reconstruction
  • Element-wise and tensor-tensor arithmetics
  • Building tensors from black-box functions using cross-approximation
  • Finding global maxima and minima from tensors
  • Statistics and sensitivity analysis
  • Optimization using autodifferentiation
  • Misc. operations on tensors: stacking, unfolding, sampling, derivating, etc.
  • Batch operations (work in progress)

Available tensor formats include:

For example, the following networks both represent a 4D tensor (i.e. a real function that can take I1 x I2 x I3 x I4 possible values) in the TT and TT-Tucker formats:

In tntorch, all tensor decompositions share the same interface. You can handle them in a transparent form, as if they were plain NumPy arrays or PyTorch tensors:

> import tntorch as tn
> t = tn.randn(32, 32, 32, 32, ranks_tt=5)  # Random 4D TT tensor of shape 32 x 32 x 32 x 32 and TT-rank 5
> print(t)

4D TT tensor:

 32  32  32  32
  |   |   |   |
 (0) (1) (2) (3)
 / \ / \ / \ / \
1   5   5   5   1

> print(tn.mean(t))

tensor(8.0388)

> print(tn.norm(t))

tensor(9632.3726)

Decompressing tensors is easy:

> print(t.torch().shape)
torch.Size([32, 32, 32, 32])

Thanks to PyTorch's automatic differentiation, you can easily define all sorts of loss functions on tensors:

def loss(t):
    return torch.norm(t[:, 0, 10:, [3, 4]].torch())  # NumPy-like "fancy indexing" for arrays

Most importantly, loss functions can be defined on compressed tensors as well:

def loss(t):
    return tn.norm(t[:3, :3, :3, :3] - t[-3:, -3:, -3:, -3:])

Check out the introductory notebook for all the details on the basics.

Tutorial Notebooks

Installation

You can install tntorch using pip:

pip install tntorch

Alternatively, you can install from the source:

git clone https://github.com/rballester/tntorch.git
cd tntorch
pip install .

For functions that use cross-approximation, the optional package maxvolpy is required (it can be installed via pip install maxvolpy).

Testing

We use pytest. Simply run:

cd tests/
pytest

Contributing

Pull requests are welcome!

Besides using the issue tracker, feel also free to contact me at [email protected].

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].