TLViz


NameTLViz JSON
Version 0.1.1 PyPI version JSON
download
home_pagehttps://tensorly.org/viz
SummaryPackage to visualise component-based decomposition models such as PCA and PARAFAC
upload_time2022-05-26 07:38:19
maintainer
docs_urlNone
authorMarie Roald & Yngve Mardal Moe
requires_python
license"MIT license",
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ==================================================
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

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

.. 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://img.shields.io/badge/code%20style-black-000000.svg
    :target: https://github.com/psf/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 <https://tensorly.org/viz>`_ and includes

* A `primer on tensors <https://tlviz.readthedocs.io/en/latest/about_tensors.html#what-are-tensors-and-tensor-decompositions>`_, `tensor factorisations <https://tlviz.readthedocs.io/en/latest/about_tensors.html#what-are-tensor-factorisations>`_ and the `notation we use <https://tlviz.readthedocs.io/en/latest/about_tensors.html#notation>`_
* `An example gallery <https://tlviz.readthedocs.io/en/latest/auto_examples/index.html>`_
* `The API reference <https://tlviz.readthedocs.io/en/latest/api.html>`_


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

TLViz supports Python 3.7 or above (it may also work with Python 3.6, 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 tlviz

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 <https://pingouin-stats.org>`_.

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


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:

#. 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,
#. and plot the components using matplotlib.

All these steps are described in the `API documentation <https://tlviz.readthedocs.io/en/latest/api.html>`_ 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 <https://tlviz.readthedocs.io/en/latest/contributing.html>`_.



            

Raw data

            {
    "_id": null,
    "home_page": "https://tensorly.org/viz",
    "name": "TLViz",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Marie Roald & Yngve Mardal Moe",
    "author_email": "roald.marie@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/cf/7f/75eae7aa41373373ba64a28fb89a89761f66fb12f7e7c72cb98d6be0085a/TLViz-0.1.1.tar.gz",
    "platform": null,
    "description": "==================================================\nTLViz \u2014 Visualising and analysing component models\n==================================================\n\n.. image:: https://github.com/tensorly/viz/workflows/tests/badge.svg\n    :target: https://github.com/tensorly/viz/actions/workflows/tests.yml\n    :alt: Tests\n\n.. image:: https://codecov.io/gh/tensorly/viz/branch/main/graph/badge.svg?token=QhgCjtr2qk\n    :target: https://codecov.io/gh/tensorly/viz\n    :alt: Coverage\n\n.. image:: https://github.com/tensorly/viz/actions/workflows/build_doc.yml/badge.svg\n        :target: https://github.com/tensorly/viz/actions/workflows/build_doc.yml\n        :alt: Documentation Status\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n    :target: https://github.com/psf/black\n\nTLViz is a Python package for visualising component-based decomposition models like PARAFAC and PCA.\n\nDocumentation\n-------------\n\nThe documentation\nis available on `the TensorLy website <https://tensorly.org/viz>`_ and includes\n\n* A `primer on tensors <https://tlviz.readthedocs.io/en/latest/about_tensors.html#what-are-tensors-and-tensor-decompositions>`_, `tensor factorisations <https://tlviz.readthedocs.io/en/latest/about_tensors.html#what-are-tensor-factorisations>`_ and the `notation we use <https://tlviz.readthedocs.io/en/latest/about_tensors.html#notation>`_\n* `An example gallery <https://tlviz.readthedocs.io/en/latest/auto_examples/index.html>`_\n* `The API reference <https://tlviz.readthedocs.io/en/latest/api.html>`_\n\n\nDependencies\n------------\n\nTLViz supports Python 3.7 or above (it may also work with Python 3.6, though that is not officially supported).\n\nInstallation requires matplotlib, numpy, pandas, scipy, statsmodels and xarray.\n\nInstallation\n------------\n\nTo install the latest stable release of TLViz and its dependencies, run:\n\n.. code:: raw\n\n    pip install tlviz\n\nThere is also functionality to create improved QQ-plots with Pingoiun.\nHowever, this is disabled by default due to the restrictive GPL lisence.\nTo enable this possibility, you must manually `install Pingoiun <https://pingouin-stats.org>`_.\n\nTo install the latest development version of TLViz, you can either clone\nthis repo or run\n\n.. code:: raw\n\n    pip install git+https://github.com/marieroald/tlviz.git\n\n\nExample\n-------\n\n.. code:: python\n\n    import tlviz\n    import matplotlib.pyplot as plt\n    from tensorly.decomposition import parafac\n\n    def fit_parafac(dataset, num_components, num_inits):\n        model_candidates = [\n            parafac(dataset.data, num_components, init=\"random\", random_state=i)\n            for i in range(num_inits)\n        ]\n        model = tlviz.multimodel_evaluation.get_model_with_lowest_error(\n            model_candidates, dataset\n        )\n        return tlviz.postprocessing.postprocess(model, dataset)\n\n    data = tlviz.data.load_aminoacids()\n    cp_tensor = fit_parafac(data, 3, num_inits=3)\n    tlviz.visualisation.components_plot(cp_tensor)\n    plt.show()\n\n.. code:: raw\n\n    Loading Aminoacids dataset from:\n    Bro, R, PARAFAC: Tutorial and applications, Chemometrics and Intelligent Laboratory Systems, 1997, 38, 149-171\n\n.. image:: docs/figures/readme_example.svg\n    :width: 800\n    :alt: An example figure showing the component vectors of a three component PARAFAC model fitted to a fluoresence spectroscopy dataset.\n\nThis example uses TensorLy to fit five three-component PARAFAC models to the data. Then it uses TLViz to:\n\n#. Select the model that gave the lowest reconstruction error,\n#. normalise the component vectors, storing their magnitude in a separate weight-vector,\n#. permute the components in descending weight (i.e. signal strength) order,\n#. flip the components so they point in a logical direction compared to the data,\n#. convert the factor matrices into Pandas DataFrames with logical indices,\n#. and plot the components using matplotlib.\n\nAll these steps are described in the `API documentation <https://tlviz.readthedocs.io/en/latest/api.html>`_ with references to the literature.\n\nTesting\n-------\n\nThe test suite requires an additional set of dependencies. To install these, run\n\n.. code:: raw\n\n    pip install tlviz[test]\n\nor\n\n.. code:: raw\n\n    pip install -e .[test]\n\ninside your local copy of the TLViz repository.\n\nThe tests can be run by calling ``pytest`` with no additional arguments.\nAll doctests are ran by default and a coverage summary will be printed on the screen.\nTo generate a coverage report, run ``coverage html``.\n\nContributing\n------------\n\nContributions are welcome to TLViz, see the `contribution guidelines <https://tlviz.readthedocs.io/en/latest/contributing.html>`_.\n\n\n",
    "bugtrack_url": null,
    "license": "\"MIT license\",",
    "summary": "Package to visualise component-based decomposition models such as PCA and PARAFAC",
    "version": "0.1.1",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "abaed98edec8984dbd12d99b4cf8acb12f1c873cf34a9896bb4894321457803d",
                "md5": "4d0164648467337dd590923c331d6454",
                "sha256": "1d221a1e47a4227dcb34c2f934c9dfe39dc840429607d1e6c107fc55a61c217b"
            },
            "downloads": -1,
            "filename": "TLViz-0.1.1-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4d0164648467337dd590923c331d6454",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 701197,
            "upload_time": "2022-05-26T07:38:17",
            "upload_time_iso_8601": "2022-05-26T07:38:17.113577Z",
            "url": "https://files.pythonhosted.org/packages/ab/ae/d98edec8984dbd12d99b4cf8acb12f1c873cf34a9896bb4894321457803d/TLViz-0.1.1-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cf7f75eae7aa41373373ba64a28fb89a89761f66fb12f7e7c72cb98d6be0085a",
                "md5": "dcdb60ef6c15f2c52d6e9e390c9f3df6",
                "sha256": "72835c38fedf02290bf0b7540def77a756a2b0389a91373365610e7cd985a93b"
            },
            "downloads": -1,
            "filename": "TLViz-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "dcdb60ef6c15f2c52d6e9e390c9f3df6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 632415,
            "upload_time": "2022-05-26T07:38:19",
            "upload_time_iso_8601": "2022-05-26T07:38:19.086738Z",
            "url": "https://files.pythonhosted.org/packages/cf/7f/75eae7aa41373373ba64a28fb89a89761f66fb12f7e7c72cb98d6be0085a/TLViz-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-05-26 07:38:19",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "tlviz"
}
        
Elapsed time: 0.06353s