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

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.5.tar.gz (90.4 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.5-py3-none-any.whl (94.7 kB view details)

Uploaded Python 3

File details

Details for the file scud-0.0.5.tar.gz.

File metadata

  • Download URL: scud-0.0.5.tar.gz
  • Upload date:
  • Size: 90.4 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.5.tar.gz
Algorithm Hash digest
SHA256 ecbd388561daa0b8d1a413e9ae1e33499deb5cb3c1bd0487491d93237ec5f367
MD5 b919720f95a387871b461f8f01abf763
BLAKE2b-256 e7d06bd601174ebc55608fe68b95059e4f0b0dda96ae42c35e6121c697a5e89c

See more details on using hashes here.

File details

Details for the file scud-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: scud-0.0.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 5838f1e39f99832c197d47a01ff20fee6c38559bc6df6686952dc862bf7f3f96
MD5 f7ec10e99297fb57bdb41055da20d91b
BLAKE2b-256 2ac966da460eac759a048c1024a9c6041c7029dc9834f850319efe66a38752a8

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