Git Product home page Git Product logo

ttrecipes's Introduction

ttrecipes

ttrecipes is a Python library for working with, visualizing and understanding tensors (multiway arrays) compressed using the tensor train format. We make heavy use of many key possibilities offered by the TT model (many are provided by the great ttpy toolbox):

Examples

Example of surrogate modeling interactive navigation (a gradient boosting regressor trained on the UCI Airfoil Self-Noise Data Set, converted to the TT format via cross-approximation):

Sobol-based sensitivity analysis of a 10-dimensional fire-spread model (~10 seconds were needed to compute these and more higher-order indices):

See the examples/ folder for some sample scripts. Check out this Jupyter Notebook for the examples used in our paper Tensor Approximation of Advanced Metrics for Sensitivity Analysis. You can also run and interact with the notebook online using Binder Binder

Installation

ttrecipes depends on ttpy and other common scientific computation packages (SciPy, NumPy, etc). The provided environment.yml, requirements.txt and ttpy_repo.txt files collect these dependencies for an easy installation using conda or pip respectively. As usual, it is recommended to create a new Python environment for the project.

Basic dependencies

If you use conda, you can create an environment (called ttrecipes by default) with the required dependencies already installed with the following command:

conda env create --file environment.yml

Or, if you prefer, you can also use pip to install the required packages:

pip install -r requirements.txt

Do not forget to activate the newly created environment with 'conda activate' or 'source activate'.

ttpy

ttpy needs to be explicitly installed after the basic dependencies. To install a version compatible with ttrecipes, run the following pip command:

pip install -r ttpy_repo.txt

Important: due to a bug in some releases of the gfortran compiler in versions 5.0-8.0, the installation of ttpy may fail (issue #60). If this is your case, try to use a different gfortran version (e.g. gfortran-4.8) or a different compiler (e.g. ifort).

ttrecipes

Once the dependencies are ready, install ttrecipes by cloning this repository and running 'pip install' with the current version in editable mode:

git clone https://github.com/rballester/ttrecipes.git
cd ttrecipes
pip install -e .

Project Structure

  • There is a core folder containing all lower-level utilities to work with TTs. They are all imported with a horizontal structure:
import ttrecipes as tr
tr.core.anyfunction()
  • Higher-level functions are grouped as modules that have to be imported explicitly. Currently, there are:
    • mpl.py: TT visualization using matplotlib
    • tikz.py: TT visualization using TikZ
    • models.py: analytical functions for surrogate modeling, sensitivity analysis, etc.
    • sensitivity_analysis.py: high-level querying of Sobol indices, displaying and tabulating Sobol and other sensitivity metrics, etc.

For instance, use the following to visualize a TT tensor (tt.vector object from ttpy):

import ttrecipes.mpl
tr.mpl.navigation(t)

Acknowledgment

This work was partially supported by the UZH Forschungskredit "Candoc", grant number FK-16-012.

References

ttrecipes's People

Contributors

egparedes avatar rballester avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ttrecipes's Issues

omp_lib.mod

Pip install error:Fatal Error: Can't open module file 'omp_lib.mod' for reading at (1): No such file or directory

BSS tensor solution

Hi

in your book part 1, you mentioned solving BSS problem by tensorising the mixture Y to the dth-order of size 2R×2×…×2×2R. I remembering reading something about an example implementation of this solution in ttrecipes package, but I could not locate it. Can you please tell me where to find it if ot exists?

Thank you very much,

Kind Regards

Manal

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.