Structured Principal Component Analysis
Project description
Package for Statistical Components for Underlying Dimensions.
Installing
pip install scud
Documentation
The documentation can be found here.
Getting Started
The getting started can be found here.
Quick start
Import package and load data
from scud import PlnPCA, BinPCA
from scud.data import load_scrna
data_and_labels = load_scrna(return_labels = True)
counts = data_and_labels['endog']
labels = data_and_labels['labels']
Instantiate, fit the model and visualize the results for the Binomial PCA model
binpca = BinPCA(data = counts, latent_dimension = 5)
binpca.fit()
binpca.viz(colors = labels)
Instantiate, fit the model and visualize the results for the Poisson-log Normal PCA model
plnpca = PlnPCA(data = counts, latent_dimension = 5)
plnpca.fit()
plnpca.viz(colors = labels)
Supervised learning using labels
One hot encode the labels
from sklearn.preprocessing import OneHotEncoder
import numpy as np
labels = np.array(labels).reshape(-1, 1)
encoder = OneHotEncoder()
exog = encoder.fit_transform(labels).toarray()
additional_data = {"exog": exog}
Instantiate and fit the PlnPCA model
plnpca = PlnPCA(data = counts, latent_dimension = 5, additional_data = additional_data)
plnpca.fit()
plnpca.viz(colors = labels.reshape(-1))
Instantiate and fit the BinPCA model
binpca = PlnPCA(data = counts, latent_dimension = 5, additional_data = additional_data)
binpca.fit()
binpca.viz(colors = labels.reshape(-1))
CONTRIBUTING
You should run pre-commit install in the repo directory before commiting (if pre-commit is not installed,
you can pip install it). This will make sure each python file is well
formated and pylint will check the code before any python file is committed. You can check the .pre-commit-config.yaml file for more details on pylint configuration.
🛠 Installation
⚡️ Citations
Please cite our work:
Batardière, Bastien, Joon Kwon, Julien Chiquet, and Julien Stoehr (2024). “Importance sampling based gradient method for dimension reduction in Poisson Log-Normal model.” In: arXiv. url: https://arxiv.org/abs/2410.00476.
Project details
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 scud-0.0.6.tar.gz.
File metadata
- Download URL: scud-0.0.6.tar.gz
- Upload date:
- Size: 351.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a823d0b9ae1b48bdc218a2897895c373a49b26b1927a52db218e401f3970ddc
|
|
| MD5 |
b198fe54fb9bd9ea99845b7d80aa3c51
|
|
| BLAKE2b-256 |
b5f62d78198bb976b4ffd68b1f9ecdce0e2e1277a864f065247280b2b4244254
|
File details
Details for the file scud-0.0.6-py3-none-any.whl.
File metadata
- Download URL: scud-0.0.6-py3-none-any.whl
- Upload date:
- Size: 94.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
416703064c58bffe9497498e9282689c96912484f136959f5189eb04ff7319e0
|
|
| MD5 |
8b9a6b4292c780b010cba15b0c18bd5d
|
|
| BLAKE2b-256 |
f8c43a158916fea6fd9b9626511696985df3887e7668be9eb273298ed0db9ba0
|