Ensemble deep learning of embeddings for clustering multimodal single-cell omics data
Project description
SnapCCESS
A python package to generate ensemble deep learning of embeddings for clustering multimodal single-cell omics data
Installation
Stable version
pip install snapccess --index-url https://pypi.org/simple
https://pypi.org/project/snapccess/
Development version
pip install snapccess --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple
https://test.pypi.org/project/snapccess/
The functions in this package are described below.
snapshotVAE
Description
To create the VAE model
Usage
model = snapshotVAE(num_features=[nfeatures_rna,nfeatures_pro], num_hidden_features=[hidden_rna2,hidden_pro2], z_dim=z_dim)
Arguments
- num_features: a list of number of features of each modality
- num_hidden_features: the number of hidden features we will used in training the model, in our paper, we use
hidden_rna=185, andhidden_pro=30 - z_dim: dimension of the latent space, in our paper, we use
z_dim=100
Output
A VAE model
train_model
Description
Training a VAE model with Snapshot learning rate or constant learning rate
Usage
model,histroy,embedding = train_model(model, train_dl, valid_dl, lr=lr, epochs=epochs,epochs_per_cycle=epochs_per_cycle, save_path=\"\",snapshot=True,embedding_number=1)
Arguments
- model: a vae model
- train_dl: training dataset
- valid_dl: validation dataset
- lr: initial learning rate
- epochs: total number of train cycles for snapshot ensemble vae
- epochs_per_cycle: the number of epochs per cycle
- save_path: the output file path of embeddings, by default leave it blank will not save any embeddings into the
save_path, but thetrain_modelwill return the embeddings - snapshot: a boolean value to indicate the model whether to use the snapshot ensemble method or the traditional VAE method (with constant learning rate)
- embeddings_number: a value to indicate the index of embeddings in the output filename when apply the traditional VAE
Output
This function will return the model, the loss of training and validation dataset (history) and a list of the latent space embeddings (for Snapshot ensemble method) or a single embedding for traditional VAE method.
get_encodings
Description
To get the embeddings from model after training.
Usage
embedding = get_encodings(model,valid_dl)
Arguments
- model: a VAE model
- valid_dl: the dataset that used as input to training the VAE model
Output
Embedding of the valid_dl dataset in the VAE model, to convert it to a matrix, try pd.DataFrame(embedding.cpu().numpy())
nvidia_info
Description
To monitor the memory usage of GPU
Usage
memory = nvidia_info(pid)['memory']
Arguments
- pid: the pid of running script
Output
This function will return the memory usage of the pid process.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file snapccess-0.2.2.tar.gz.
File metadata
- Download URL: snapccess-0.2.2.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.8.17 Linux/6.7+pk12.52
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
617664324f55a2f3f14a3e7e01d4acea5fc2ee311be60dff144e2746f25b9a30
|
|
| MD5 |
6f2097b7049c3ce88cbf7532f13089b1
|
|
| BLAKE2b-256 |
0bc3dfc9f7f2304a8cd1005088c296314e59505b7248bbb2b4a1c8ee0c3c924e
|
File details
Details for the file snapccess-0.2.2-py3-none-any.whl.
File metadata
- Download URL: snapccess-0.2.2-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.8.17 Linux/6.7+pk12.52
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
772dc7ad167e773ecd47cafc0a319e6561f384f8852a394e248b5cb891dec93d
|
|
| MD5 |
3ad4ffeb9c39532eb0b48ae009b39cfc
|
|
| BLAKE2b-256 |
5039aa24cfb2001c8dcd0041b55884698eb91e537b2c8bac5e5f3d4aaf3634e2
|