Skip to main content
CCA-Zoo

CCA-Zoo

Multiview Canonical Correlation Analysis in Python

PyPI Python CI codecov DOI License: MIT uv Ruff Types: mypy strict

CCA-Zoo is a Python library of reference implementations of Canonical Correlation Analysis (CCA) algorithms from the literature, from classical CCA (Hotelling 1936) through sparse, kernel, deep, and probabilistic variants — each documented with the paper it comes from. It's also built to be used directly: every model follows the same scikit-learn estimator API (fit, transform, fit_transform, score), is fully typed (PEP 561), and is tested against known closed-form solutions where one exists.


Installation

uv add cca-zoo        # or: pip install cca-zoo

Install optional extras as needed:

uv add "cca-zoo[deep]"          # DCCA variants (requires PyTorch + Lightning)
uv add "cca-zoo[probabilistic]" # Probabilistic CCA (requires NumPyro + JAX)
uv add "cca-zoo[tree]"          # TreeCCA (requires XGBoost, optionally LightGBM)
uv add "cca-zoo[all]"           # Everything above

(substitute pip install for uv add if you're not using uv)


Quick start

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
PartialCCA CCA adjusted for confounding variables (Rao 1969) ≥2
GRCCA Group-regularised CCA (Tuzhilina, Tozzi & Hastie 2021) ≥2
CCAR3 CCA via reduced-rank regression, row-sparse in high dimensions (Donnat & Tuzhilina 2024) 2
CCA_EY Stochastic Eckart-Young CCA (unconstrained gradient descent) 2
PLS_EY Stochastic Eckart-Young PLS (unconstrained gradient descent) 2
MCCA_EY Multiview Eckart-Young CCA (unconstrained gradient descent) ≥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.tree (requires [tree])

Class Description Views
TreeCCA Gradient-boosted-tree CCA (Eckart-Young objective) ≥2

cca_zoo.deep (requires [deep])

Built on PyTorch Lightning — models are trained with a standard lightning.Trainer, not a fit() wrapper. See the deep learning guide.

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
DMCCA Deep multiset CCA — pairwise-sum objective, ≥2 views
DGCCA Benton et al. 2019 — deep generalised CCA, ≥2 views
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

cca_zoo.model_selection

Class Description
GridSearchCV Cross-validated hyperparameter search for multiview models

Documentation

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

See CHANGELOG.md for what's changed between releases.


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.

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.1.0.tar.gz (398.1 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.1.0-py3-none-any.whl (99.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cca_zoo-3.1.0.tar.gz
  • Upload date:
  • Size: 398.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cca_zoo-3.1.0.tar.gz
Algorithm Hash digest
SHA256 044a8954370285e159c620558b1753ee7a022d6bbbde2fb4e76ac4c83ab0ef9c
MD5 77ca1e39c75d1deb462f4f7495549fef
BLAKE2b-256 923ee2caaef4b6f8b6b72abb62c6c9cc0e372f8cb7d1ab43cde9e67ace277b75

See more details on using hashes here.

Provenance

The following attestation bundles were made for cca_zoo-3.1.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.1.0-py3-none-any.whl.

File metadata

  • Download URL: cca_zoo-3.1.0-py3-none-any.whl
  • Upload date:
  • Size: 99.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cca_zoo-3.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bdf8c071bbe22f79e3f4776a6082b85ca1315d3ac96291d88ac66c61b7133d10
MD5 25638c11848ff47246b532dbcaf62178
BLAKE2b-256 e1911465d066c577f9b2f6e3424a1d3d96b789437b22aec0740958e9cc73b6c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for cca_zoo-3.1.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.

Release history Release notifications | RSS feed

3.1.1

2 files

This release

3.1.0 This release

2 files

3.0.0

2 files

2.6.0

2 files

2.5.0

2 files

2.4.0

2 files

2.3.11

2 files

2.3.10

2 files

2.3.9

2 files

2.3.8

2 files

2.3.7

2 files

2.3.6

2 files

2.3.5

2 files

2.3.4

2 files

2.3.3

2 files

2.3.2

2 files

2.3.1

2 files

2.3

2 files

2.2.1

2 files

2.2.0

2 files

2.1.0

2 files

2.0.8

2 files

2.0.7

2 files

2.0.6

2 files

2.0.5

2 files

2.0.4

2 files

2.0.3

2 files

2.0.2

2 files

2.0.1

2 files

2.0.0

2 files

1.17.7

2 files

1.17.6

2 files

1.17.5

2 files

1.17.4

2 files

1.17.3

2 files

1.17.2

2 files

1.17.1

2 files

1.17.0

2 files

1.16.19

2 files

1.16.18

2 files

1.16.17

2 files

1.16.16

2 files

1.16.15

2 files

1.16.14

2 files

1.16.13

2 files

1.16.12

2 files

1.16.11

2 files

1.16.10

2 files

1.16.9

2 files

1.16.8

2 files

1.16.7

2 files

1.16.6

2 files

1.16.5

2 files

1.16.4

2 files

1.16.3

2 files

1.16.2

2 files

1.16.1

2 files

1.16.0

2 files

1.15.1

2 files

1.15.0

2 files

1.14.0

2 files

1.13.5

2 files

1.13.2

2 files

1.13.1

2 files

1.13.0

2 files

1.12.11

2 files

1.12.10

2 files

1.12.9

2 files

1.12.8

2 files

1.12.7

2 files

1.12.6

2 files

1.12.5

2 files

1.12.4

2 files

1.12.3

2 files

1.12.2

2 files

1.12.1

2 files

1.12.0

2 files

1.11.1

2 files

1.11.0

2 files

1.10.16

2 files

1.10.15

2 files

1.10.14

2 files

1.10.13

2 files

1.10.12

2 files

1.10.11

2 files

1.10.10

2 files

1.10.9

2 files

1.10.8

2 files

1.10.7

2 files

1.10.6

2 files

1.10.5

2 files

1.10.4

2 files

1.10.3

2 files

1.10.2

2 files

1.10.1.1

2 files

1.10.1

2 files

1.9.1

2 files

1.9.0

2 files

1.8.0

2 files

1.7.19

2 files

1.7.18

2 files

1.7.17

2 files

1.7.16

2 files

1.7.15

2 files

1.7.14

2 files

1.7.13

2 files

1.7.12

2 files

1.7.11

2 files

1.7.10

2 files

1.7.9

2 files

1.7.8

2 files

1.7.7

2 files

1.7.6

2 files

1.7.5

2 files

1.7.4

2 files

1.7.3

2 files

1.7.2

2 files

1.7.1

2 files

1.7.0

2 files

1.6.3

2 files

1.6.2

2 files

1.6.1

2 files

1.6.0

2 files

1.5.0

2 files

1.4.4

2 files

1.4.3

2 files

1.4.2

2 files

1.4.1

2 files

1.4.0

2 files

1.3.0

2 files

1.2.6

2 files

1.2.5

2 files

1.2.4

1 file

1.2.3

1 file

1.2.2

1 file

1.2.1

1 file

1.2.0

1 file

1.1.28

1 file

1.1.27

1 file

1.1.26

1 file

1.1.25

1 file

1.1.24

1 file

1.1.23

1 file

1.1.22

1 file

1.1.21

1 file

1.1.20

1 file

1.1.19

1 file

1.1.18

1 file

1.1.17

1 file

1.1.16

1 file

1.1.15

1 file

1.1.14

1 file

1.1.13

1 file

1.1.12

1 file

1.1.11

1 file

1.1.10

1 file

1.1.9

1 file

1.1.8

1 file

1.1.6

1 file

1.1.5

1 file

1.1.4

1 file

1.1.3

1 file

1.1.2

1 file

1.1.1

1 file

1.0.13

1 file

1.0.12

1 file

1.0.10

2 files

1.0.9

2 files

1.0.8

2 files

1.0.7

2 files

1.0.6

1 file

1.0.5

1 file

1.0.4

1 file

1.0.3

1 file

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page