TLViz

TLViz: Visualising and analysing tensor decomposition models with Python - Published in JOSS (2022)

https://github.com/tensorly/viz

Science Score: 98.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 5 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: joss.theoj.org, zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords

tensor-methods tensorly tensors visualization
Last synced: 4 months ago · JSON representation ·

Repository

Easy visualization and evaluation of matrix and tensor factorization models

Basic Info
  • Host: GitHub
  • Owner: tensorly
  • License: mit
  • Language: Python
  • Default Branch: main
  • Homepage: https://tensorly.org/viz/
  • Size: 135 MB
Statistics
  • Stars: 17
  • Watchers: 3
  • Forks: 4
  • Open Issues: 3
  • Releases: 2
Topics
tensor-methods tensorly tensors visualization
Created over 4 years ago · Last pushed almost 3 years ago
Metadata Files
Readme Contributing License Citation

README.rst

==================================================
TLViz — Visualising and analysing component models
==================================================

.. image:: https://github.com/tensorly/viz/workflows/tests/badge.svg
    :target: https://github.com/tensorly/viz/actions/workflows/tests.yml
    :alt: Tests Status

.. image:: https://codecov.io/gh/tensorly/viz/branch/main/graph/badge.svg?token=QhgCjtr2qk
    :target: https://codecov.io/gh/tensorly/viz
    :alt: Coverage Status

.. image:: https://github.com/tensorly/viz/actions/workflows/build_doc.yml/badge.svg
    :target: https://github.com/tensorly/viz/actions/workflows/build_doc.yml
    :alt: Documentation Status

.. image:: https://zenodo.org/badge/354456143.svg
   :target: https://zenodo.org/badge/latestdoi/354456143
   :alt: Zenodo DOI

.. image:: https://joss.theoj.org/papers/10.21105/joss.04754/status.svg
    :target: https://doi.org/10.21105/joss.04754
    :alt: JOSS | 10.21105/joss.04754

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
    :target: https://github.com/psf/black
    :alt: Code style: Black

TLViz is a Python package for visualising component-based decomposition models like PARAFAC and PCA.

Documentation
-------------

The documentation
is available on `the TensorLy website `_ and includes

* A `primer on tensors `_, `tensor factorisations `_ and the `notation we use `_
* `An example gallery `_
* `The API reference `_


Dependencies
------------

TLViz supports Python 3.8 or above (it may also work with Python 3.6 and 3.7, though that is not officially supported).

Installation requires matplotlib, numpy, pandas, scipy, statsmodels and xarray.

Installation
------------

To install the latest stable release of TLViz and its dependencies, run:

.. code:: raw

    pip install tensorly-viz

There is also functionality to create improved QQ-plots with Pingoiun.
However, this is disabled by default due to the restrictive GPL lisence.
To enable this possibility, you must manually `install Pingoiun `_.

To install the latest development version of TLViz, you can either clone
this repo or run

.. code:: raw

    pip install git+https://github.com/marieroald/tlviz.git


Some extra dependencies are needed to run the examples, tests or build the documentation.
For more information about installing these dependencies, see the `installation guide `_.

Example
-------

.. code:: python

    import tlviz
    import matplotlib.pyplot as plt
    from tensorly.decomposition import parafac

    def fit_parafac(dataset, num_components, num_inits):
        model_candidates = [
            parafac(dataset.data, num_components, init="random", random_state=i)
            for i in range(num_inits)
        ]
        model = tlviz.multimodel_evaluation.get_model_with_lowest_error(
            model_candidates, dataset
        )
        return tlviz.postprocessing.postprocess(model, dataset)

    data = tlviz.data.load_aminoacids()
    cp_tensor = fit_parafac(data, 3, num_inits=3)
    tlviz.visualisation.components_plot(cp_tensor)
    plt.show()

.. code:: raw

    Loading Aminoacids dataset from:
    Bro, R, PARAFAC: Tutorial and applications, Chemometrics and Intelligent Laboratory Systems, 1997, 38, 149-171

.. image:: docs/figures/readme_example.svg
    :width: 800
    :alt: An example figure showing the component vectors of a three component PARAFAC model fitted to a fluoresence spectroscopy dataset.

This example uses TensorLy to fit five three-component PARAFAC models to the data. Then it uses TLViz to do the following steps:

#. Select the model that gave the lowest reconstruction error.
#. Normalise the component vectors, storing their magnitude in a separate weight-vector.
#. Permute the components in descending weight (i.e. signal strength) order.
#. Flip the components so they point in a logical direction compared to the data.
#. Convert the factor matrices into Pandas DataFrames with logical indices.
#. Plot the components using matplotlib.

All these steps are described in the `API documentation `_ with references to the literature.

Testing
-------

The test suite requires an additional set of dependencies. To install these, run

.. code:: raw

    pip install tlviz[test]

or

.. code:: raw

    pip install -e .[test]

inside your local copy of the TLViz repository.

The tests can be run by calling ``pytest`` with no additional arguments.
All doctests are ran by default and a coverage summary will be printed on the screen.
To generate a coverage report, run ``coverage html``.

Contributing
------------

Contributions are welcome to TLViz, see the `contribution guidelines `_.

Owner

  • Name: TensorLy
  • Login: tensorly
  • Kind: organization

Tensor Learning in Python.

JOSS Publication

TLViz: Visualising and analysing tensor decomposition models with Python
Published
November 25, 2022
Volume 7, Issue 79, Page 4754
Authors
Marie Roald ORCID
Simula Metropolitan Center for Digital Engineering, Norway, Oslo Metropolitan University, Norway
Yngve Mardal Moe ORCID
Independent Researcher, Norway
Editor
Fabian-Robert Stöter ORCID
Tags
tensor decompositions data mining data visualisation TensorLy

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
  - family-names: Marie
    given-names: Roald
    orcid: https://orcid.org/0000-0002-9571-8829
  - family-names: Yngve Mardal
    given-names: Moe
    orcid: https://orcid.org/0000-0002-5159-9012
title: "TensorLy-Viz"
version: 0.1.7
preferred-citation:
  authors:
    - family-names: Marie
      given-names: Roald
      orcid: https://orcid.org/0000-0002-9571-8829
    - family-names: Yngve Mardal
      given-names: Moe
      orcid: https://orcid.org/0000-0002-5159-9012
  type: article
  doi: 10.21105/joss.04754
  title: "TLViz: Visualising and analysing tensor decomposition models with Python"
  journal: "Journal of Open Source Software"
  date-released: 2022-11-25

GitHub Events

Total
  • Watch event: 2
Last Year
  • Watch event: 2

Committers

Last synced: 5 months ago

All Time
  • Total Commits: 343
  • Total Committers: 4
  • Avg Commits per committer: 85.75
  • Development Distribution Score (DDS): 0.391
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Marie Roald r****e@g****m 209
Yngve Mardal Moe y****e@g****m 131
Jean Kossaifi j****i@g****m 2
TUNA Caglayan c****a@i****r 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 15
  • Total pull requests: 7
  • Average time to close issues: 2 days
  • Average time to close pull requests: about 19 hours
  • Total issue authors: 7
  • Total pull request authors: 3
  • Average comments per issue: 2.07
  • Average comments per pull request: 2.0
  • Merged pull requests: 6
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 0
  • Average time to close issues: about 4 hours
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 0
  • Average comments per issue: 2.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • yiitozer (7)
  • caglayantuna (2)
  • sara-02 (2)
  • yngvem (1)
  • cchatzis (1)
  • HHhyJJ (1)
  • jonathanstathakis (1)
Pull Request Authors
  • yngvem (3)
  • MarieRoald (2)
  • caglayantuna (2)
Top Labels
Issue Labels
Pull Request Labels

Dependencies

requirements.txt pypi
  • autodocsumm *
  • black *
  • build *
  • bump2version *
  • coverage *
  • flake8 *
  • isort *
  • numpydoc *
  • pip *
  • plotly *
  • pytest *
  • pytest-cov *
  • pytest-randomly *
  • sphinx *
  • sphinx-gallery *
  • sphinxcontrib-bibtex *
  • tensorly *
  • tensorly_sphinx_theme *
  • tox *
  • twine *
  • wheel *
.github/workflows/build_doc.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
.github/workflows/deploy_pypi.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • pypa/gh-action-pypi-publish master composite
.github/workflows/tests.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • codecov/codecov-action v2 composite