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
| Class | Reference |
|---|---|
GFA |
Klami, Virtanen & Kaski 2013 — Group Factor Analysis, per-view ARD; no extra dependencies |
ProbabilisticCCA (requires [probabilistic]) |
Bach & Jordan 2005 — MCMC via NumPyro |
VariationalBayesCCA (requires [probabilistic]) |
Wang 2007 — variational inference + ARD 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
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 cca_zoo-3.1.1.tar.gz.
File metadata
- Download URL: cca_zoo-3.1.1.tar.gz
- Upload date:
- Size: 423.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73aac8d1c22a5f597ec7c0c3e32d75ab2a4e85bbb2fea1d6fc5ee5f0cfc92ccb
|
|
| MD5 |
f14db628cb7fad07b28f13dc58e8f39e
|
|
| BLAKE2b-256 |
e860231ae3f245c88e257d0ca29563498e05601065d9bde5f87d9e83f73875ae
|
Provenance
The following attestation bundles were made for cca_zoo-3.1.1.tar.gz:
Publisher:
ci.yml on jameschapman19/cca_zoo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cca_zoo-3.1.1.tar.gz -
Subject digest:
73aac8d1c22a5f597ec7c0c3e32d75ab2a4e85bbb2fea1d6fc5ee5f0cfc92ccb - Sigstore transparency entry: 2341200083
- Sigstore integration time:
-
Permalink:
jameschapman19/cca_zoo@a954498f613dcbbfdd81c9a2c957090c66d613dd -
Branch / Tag:
refs/tags/v3.1.1 - Owner: https://github.com/jameschapman19
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@a954498f613dcbbfdd81c9a2c957090c66d613dd -
Trigger Event:
release
-
Statement type:
File details
Details for the file cca_zoo-3.1.1-py3-none-any.whl.
File metadata
- Download URL: cca_zoo-3.1.1-py3-none-any.whl
- Upload date:
- Size: 114.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fcabcd01b57cd36b0584547d508eb5d2e3868921f4e0469a964566b4a58520b5
|
|
| MD5 |
10a7ecb25220f7c12657361d6818d520
|
|
| BLAKE2b-256 |
7cf9d12e774e96873b2eca7aec7c91525c9da12335a1814a2e67f38895de1fa8
|
Provenance
The following attestation bundles were made for cca_zoo-3.1.1-py3-none-any.whl:
Publisher:
ci.yml on jameschapman19/cca_zoo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cca_zoo-3.1.1-py3-none-any.whl -
Subject digest:
fcabcd01b57cd36b0584547d508eb5d2e3868921f4e0469a964566b4a58520b5 - Sigstore transparency entry: 2341200104
- Sigstore integration time:
-
Permalink:
jameschapman19/cca_zoo@a954498f613dcbbfdd81c9a2c957090c66d613dd -
Branch / Tag:
refs/tags/v3.1.1 - Owner: https://github.com/jameschapman19
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@a954498f613dcbbfdd81c9a2c957090c66d613dd -
Trigger Event:
release
-
Statement type: