Collection of modules to easily interpret Deep Learned latent spaces
Project description
LatInt: a Python package to help Interpret your Latent Space
The goal of this package is to facilitate the interpretation and quality control of low-dimensional latent spaces generated by dimensionality reduction methods, using heterogeneous input feature types (e.g. Numerical as well as image-based inputs).
In development:
This package was the results of the collective efforts of our lab prompted by the immediate need for some of these functions, and as such are extremely tailored to our workflows. It's actively under development and extra modules, generalization and documentation are all still underway. If you use a module that requires components of the learning of your latent space, such as a model or a dataset, it is assumed the learning has been done using pytorch. In the future we will generalize this.
Modules:
Getting started:
- Install package:
pip install latint
- Load your latent space by calculating it from your trained model and input data:
from latint.load import getLatentFromModel
latent = getLatentFromModel(model, data)
- However you load your latent space, the result should either be a numpy array OR an anndata object, with the latent space accessible in adata.obsm['latent_key']
- Note: The rest of this package assumes you're inputting either of them, some will specifically need the anndata object if the input data or metadata is also required for its functionality.
Optional:
- Encapsulate latent space and input data in an anndata object
adata = ad.AnnData(data, dtype=data.dtype)
adata.obsm["latent"] = latent
- Add metadata of the input data to the adata object
metadata_df = pd.read_csv("/path/to/your/metadata.csv")
addMetadataFromPandas(adata, metadata_df)
Documentation
The generation of the documentation website is a work in progress, but all functional modules have clearly written docstrings.
Dependencies:
- numpy
- pandas
- tqdm
- matplotlib
- torch
- scanpy
- anndata==0.8 We take a specific version of anndata because some mismatch between anndata and scanpy exists.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file LatInt-0.1.0.tar.gz
.
File metadata
- Download URL: LatInt-0.1.0.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.6 tqdm/4.61.2 importlib-metadata/4.8.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 374e002b02170aefb01c6c6bdcb6ff27dbc448c274f290aa411e12e8860cb335 |
|
MD5 | 68023f483209d51ee01749cd66c126c0 |
|
BLAKE2b-256 | ee84f2684268499a8555c095f909f429c91d0d53fde67452ed2430875608a7cb |
Provenance
File details
Details for the file LatInt-0.1.0-py2.py3-none-any.whl
.
File metadata
- Download URL: LatInt-0.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.6 tqdm/4.61.2 importlib-metadata/4.8.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90d9b02f3c3b2cd9e5e0dbbd0ccce4eaee7dbf75aef6a83f3702692a6fd02839 |
|
MD5 | c065a8d91e3f14c14a933bd21191dd1f |
|
BLAKE2b-256 | 073334aca4953cf9a3cc482818712525c188d09f19aac9fc4d9b8526e92d45fb |