Code Monkey home page Code Monkey logo

tensor-decomposition-in-python's Introduction

Tensor Decomposition in Python

This repository gives a quick tutorial on implementing Canonical Polyadic tensor decomposition in Python, including a brief introduction to Tensor decomposition. However, the main purpose of this notebook is to focus on the implementation of tensor decomposition in Python. In line with these objectives, we will implement tensor decomposition using two libraries available in Python (TensorLy and tensortools) and a simple implementation of Tensor Decomposition with Numpy (via alternating optimization). Furthermore, the result of these three approaches are compared in terms of reconstruction error and execution time.

Content

  1. Tensor Decomposition
  2. Implementation
    • TensorLy
    • tensortools
    • Numpy
  3. Results and Comparison

Tensor Decomposition

Fig1

Example Scenario (with a neuroscientific theme)

An attempt to partially reproducing the result of this paper's figure 2.

Fig1 Fig1

Example Results and Comparison

Fig1 Fig1

For the complete tutorial click here, and for the extended version click here.


Dependencies

  • Numpy
  • Matplotlib
  • Seaborn
  • TensorLy == 0.4.3
  • tensortools

Running the notebooks inside docker container

Of course you can simply install the dependencies and run the code in your own Python environment. But another option to run the notebook in a docker container:

  1. Clone the repository
    git clone https://github.com/mohammadbashiri/tensor-decomposition-in-python.git
    
  2. Navigate to the project directory
    cd ensor-decomposition-in-python
    
  3. Build the docker image
    docker build -t ds .
    
  4. Create a container from the created image
    docker run -p 7890:8888 -v $(pwd):/project --name ds_container -d --rm ds
    
  5. By entering localhost:7890 in your browser you can open the current directory inside jupyterlab and run the notebooks

Acknowledgement

I would like to thank Annika Thierfelder for her constructive feedback on the content.


References

  • Tuncer, Yalcin, Murat M. Tanik, and David B. Allison. "An overview of statistical decomposition techniques applied to complex systems." Computational statistics & data analysis 52.5 (2008): 2292โ€“2310.
  • Cichocki, Andrzej, et al. "Tensor decompositions for signal processing applications: From two-way to multiway component analysis." IEEE Signal Processing Magazine 32.2 (2015): 145โ€“163.
  • Williams, Alex H., et al. "Unsupervised Discovery of Demixed, Low-Dimensional Neural Dynamics across Multiple Timescales through Tensor Component Analysis." Neuron (2018).
  • Talk by Tamara Kolda
  • Tutorial by Alex Williams: part 1, part 2

tensor-decomposition-in-python's People

Contributors

mohammadbashiri avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.