Skip to main content

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

scud-0.0.6.tar.gz (351.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scud-0.0.6-py3-none-any.whl (94.7 kB view details)

Uploaded Python 3

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

Hashes for scud-0.0.6.tar.gz
Algorithm Hash digest
SHA256 0a823d0b9ae1b48bdc218a2897895c373a49b26b1927a52db218e401f3970ddc
MD5 b198fe54fb9bd9ea99845b7d80aa3c51
BLAKE2b-256 b5f62d78198bb976b4ffd68b1f9ecdce0e2e1277a864f065247280b2b4244254

See more details on using hashes here.

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

Hashes for scud-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 416703064c58bffe9497498e9282689c96912484f136959f5189eb04ff7319e0
MD5 8b9a6b4292c780b010cba15b0c18bd5d
BLAKE2b-256 f8c43a158916fea6fd9b9626511696985df3887e7668be9eb273298ed0db9ba0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page