Skip to main content

Multiview CCA methods in a scikit-learn style framework

Project description

CCA-Zoo

CCA-Zoo

Multiview Canonical Correlation Analysis in Python

PyPI Python CI codecov DOI License: MIT

CCA-Zoo is a Python library implementing a wide range of Canonical Correlation Analysis (CCA) and related multiview learning methods. It follows the scikit-learn estimator API: every model exposes fit, transform, fit_transform, and score.


Installation

pip install cca-zoo

Install optional extras as needed:

pip install cca-zoo[deep]          # DCCA variants (requires PyTorch + Lightning)
pip install cca-zoo[probabilistic] # Probabilistic CCA (requires NumPyro + JAX)
pip install cca-zoo[all]           # Everything above

Quick start

import numpy as np
from cca_zoo.datasets import JointData
from cca_zoo.linear import CCA

# Generate correlated two-view data from a linear latent variable model
data = JointData(
    n_views=2,
    n_samples=200,
    n_features=[50, 50],
    latent_dimensions=2,
    signal_to_noise=2.0,
    random_state=0,
)
train_views = data.sample()
test_views  = data.sample()

# Fit CCA and evaluate
model = CCA(latent_dimensions=2).fit(train_views)
print(model.score(test_views))     # canonical correlations, shape (2,)

# Project views into the shared latent space
z1, z2 = model.transform(test_views)  # each shape (200, 2)

Available methods

cca_zoo.linear

Class Description Views
CCA Standard CCA (Hotelling 1936) 2
rCCA Regularised CCA / canonical ridge 2
PLS Partial Least Squares 2
MCCA Multiset CCA — pairwise sum objective ≥2
GCCA Generalised CCA — shared latent projection ≥2
TCCA Tensor CCA — higher-order cross-moment ≥2
CCA_EY Stochastic Eckart-Young CCA (Riemannian GD) 2
PLS_EY Stochastic Eckart-Young PLS (Riemannian GD) 2
MCCA_EY Multiview Eckart-Young CCA (Riemannian GD) ≥2
SCCA_PMD Sparse CCA via PMD (Witten 2009) ≥2
SCCA_ADMM Sparse CCA via ADMM (Suo 2017) ≥2
SCCA_IPLS Sparse CCA via iterative PLS (Mai & Zhang 2019) ≥2
SCCA_Span SpanCCA (Asteris 2016) ≥2
ElasticCCA Elastic net regularised CCA (Waaijenborg 2008) ≥2
ParkhomenkoCCA Soft-threshold sparse CCA (Parkhomenko 2009) ≥2
PLS_ALS ALS variant of PLS (power iteration) ≥2

cca_zoo.nonparametric

Class Description
KCCA Kernel CCA
KGCCA Kernel Generalised CCA
KTCCA Kernel Tensor CCA

cca_zoo.deep (requires [deep])

Class Reference
DCCA Andrew et al. 2013 — pluggable objective
DCCA_EY Eigengame / Eckart-Young objective
DCCA_NOI Wang et al. 2015 — non-linear orthogonal iterations
DCCA_SDL Chang et al. 2018 — stochastic decorrelation loss
DCCAE Wang et al. 2015 — with autoencoder reconstruction
DVCCA Wang et al. 2016 — variational
DTCCA Wong et al. 2021 — deep tensor CCA
SplitAE Split autoencoder baseline
BarlowTwins Zbontar et al. 2021
VICReg Bardes et al. 2022

cca_zoo.probabilistic (requires [probabilistic])

Class Reference
ProbabilisticCCA Bach & Jordan 2005; Wang 2007 — MCMC via NumPyro

Documentation

Full documentation, user guides, and API reference at: https://jameschapman19.github.io/cca_zoo/


Citing

If CCA-Zoo is useful in your research, please cite:

@article{Chapman2021,
  title   = {{CCA-Zoo}: A collection of Regularized, Deep Learning based, Kernel,
             and Probabilistic {CCA} methods in a scikit-learn style framework},
  author  = {Chapman, James and Wang, Hao-Ting and Wells, Lennie and Wiesner, Johannes},
  journal = {Journal of Open Source Software},
  volume  = {6},
  number  = {68},
  pages   = {3823},
  year    = {2021},
  doi     = {10.21105/joss.03823},
}

Contributing

Contributions are welcome. See docs/contributing.md for development setup, coding standards, and pull request guidelines.

Project details


Release history Release notifications | RSS feed

This version

3.0.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cca_zoo-3.0.0.tar.gz (317.7 kB view details)

Uploaded Source

Built Distribution

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

cca_zoo-3.0.0-py3-none-any.whl (70.5 kB view details)

Uploaded Python 3

File details

Details for the file cca_zoo-3.0.0.tar.gz.

File metadata

  • Download URL: cca_zoo-3.0.0.tar.gz
  • Upload date:
  • Size: 317.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cca_zoo-3.0.0.tar.gz
Algorithm Hash digest
SHA256 d2e40a81e83c1988e21d681e74dea32ff85c5495e8acf21df7e15116652d082f
MD5 323641875e5a825097082253f884dd34
BLAKE2b-256 ddbab14d34f97356864bc61743e7ea2cfa360479db43f11f1b673dc8c1e4597c

See more details on using hashes here.

Provenance

The following attestation bundles were made for cca_zoo-3.0.0.tar.gz:

Publisher: ci.yml on jameschapman19/cca_zoo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cca_zoo-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: cca_zoo-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 70.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cca_zoo-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eb672d05a3919eb5973cac9436dab1e3748e8cd8128c55f692033cd65fb0a813
MD5 faaa0d4cc2a997df2c7539541b6b2742
BLAKE2b-256 17e03429737fd26d3277e2b1b043ccf43e74f12482755d7acf81f982ec06884f

See more details on using hashes here.

Provenance

The following attestation bundles were made for cca_zoo-3.0.0-py3-none-any.whl:

Publisher: ci.yml on jameschapman19/cca_zoo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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