TLVis — Visualising and analysing component models
TLVis is a Python package for visualising component-based decomposition models like PARAFAC and PCA.
Documentation
The documentation is available on ReadTheDocs and includes
Dependencies
TLVis 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 TLVis and its dependencies, run:
pip install tlvis
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 TLVis, you can either clone this repo or run
pip install git+https://github.com/marieroald/tlvis.git
Example
import tlvis
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 = tlvis.multimodel_evaluation.get_model_with_lowest_error(
model_candidates, dataset
)
return tlvis.postprocessing.postprocess(model, dataset)
data = tlvis.data.load_aminoacids()
cp_tensor = fit_parafac(data, 3, num_inits=3)
tlvis.visualisation.components_plot(cp_tensor)
plt.show()
Loading Aminoacids dataset from:
Bro, R, PARAFAC: Tutorial and applications, Chemometrics and Intelligent Laboratory Systems, 1997, 38, 149-171
This example uses TensorLy to fit five three-component PARAFAC models to the data. Then it uses TLVis 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 with references to the literature.
Testing
The test suite requires an additional set of dependencies. To install these, run
pip install tlvis[test]
or
pip install -e .[test]
inside your local copy of the TLVis 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 TLVis, see the contribution guidelines.
Metadata
Release files for TLVis 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| TLVis-0.0.3.tar.gz | 632.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| TLVis-0.0.3-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 1.3 MB
Release files / TLVis-0.0.3.tar.gz
| Download URL | TLVis-0.0.3.tar.gz |
|---|---|
| Size | 632.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7667525e1023f56087e1fa1671f203d7e61b6938ede0a69fe23fd5ed1e7ba73b
|
|
BLAKE2b-256 checksum How to use checksums |
708f69afcb73660b9216f78c33493b7bdaf4c3735f7ef2597148700fb5098b90
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.18.4 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8
|
Release files / TLVis-0.0.3-py2.py3-none-any.whl
| Download URL | TLVis-0.0.3-py2.py3-none-any.whl |
|---|---|
| Size | 701.6 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
d9ed257a6f91a362232398e19f36667a66cc57868480dcf4b72e483118cec72b
|
|
BLAKE2b-256 checksum How to use checksums |
a672a726774759510d3101c543b94a500faa3c92dbc97f743d45bef3fae0952e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.18.4 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8
|
Security for TLVis 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.