Skip to content

cca_zoo.tree

Gradient-boosted-tree nonlinear CCA methods. Requires pip install cca-zoo[tree].


XGBoostCCA

XGBoostCCA(
    n_components: int = 1,
    *,
    center: bool = True,
    n_estimators: int | list[int] = 200,
    max_depth: int | list[int] = 3,
    learning_rate: float | list[float] = 0.1,
    subsample: float | list[float] = 0.8,
    colsample_bytree: float | list[float] = 0.8,
    min_child_weight: float | list[float] = 20,
    gauss_seidel: bool = True,
    random_state: int | None = None,
)

Bases: TreeCCA

:class:TreeCCA with XGBoost boosters.

Parameters and attributes are those of :class:TreeCCA.

References

Chapman, J. (2026). TreeCCA: Canonical Correlation Analysis via Gradient-Boosted Trees. arXiv:2607.27027.

Examples:

>>> import numpy as np
>>> from cca_zoo.tree import XGBoostCCA
>>> rng = np.random.default_rng(0)
>>> X1 = rng.standard_normal((100, 5))
>>> X2 = rng.standard_normal((100, 5))
>>> model = XGBoostCCA(
...     n_components=2, n_estimators=[10, 20], max_depth=[3, 6]
... ).fit([X1, X2])
>>> Z1, Z2 = model.transform([X1, X2])
Source code in cca_zoo/tree/_treecca.py
def __init__(
    self,
    n_components: int = 1,
    *,
    center: bool = True,
    n_estimators: int | list[int] = 200,
    max_depth: int | list[int] = 3,
    learning_rate: float | list[float] = 0.1,
    subsample: float | list[float] = 0.8,
    colsample_bytree: float | list[float] = 0.8,
    min_child_weight: float | list[float] = 20,
    gauss_seidel: bool = True,
    random_state: int | None = None,
) -> None:
    super().__init__(n_components=n_components, center=center)
    self.n_estimators = n_estimators
    self.max_depth = max_depth
    self.learning_rate = learning_rate
    self.subsample = subsample
    self.colsample_bytree = colsample_bytree
    self.min_child_weight = min_child_weight
    self.gauss_seidel = gauss_seidel
    self.random_state = random_state

LightGBMCCA

LightGBMCCA(
    n_components: int = 1,
    *,
    center: bool = True,
    n_estimators: int | list[int] = 200,
    max_depth: int | list[int] = 3,
    learning_rate: float | list[float] = 0.1,
    subsample: float | list[float] = 0.8,
    colsample_bytree: float | list[float] = 0.8,
    min_child_weight: float | list[float] = 20,
    gauss_seidel: bool = True,
    random_state: int | None = None,
)

Bases: TreeCCA

:class:TreeCCA with LightGBM boosters.

Parameters and attributes are those of :class:TreeCCA. Requires lightgbm, in the tree extra.

References

Chapman, J. (2026). TreeCCA: Canonical Correlation Analysis via Gradient-Boosted Trees. arXiv:2607.27027.

Examples:

>>> import numpy as np
>>> from cca_zoo.tree import LightGBMCCA
>>> rng = np.random.default_rng(0)
>>> X1 = rng.standard_normal((100, 5))
>>> X2 = rng.standard_normal((100, 5))
>>> model = LightGBMCCA(n_components=2, n_estimators=10).fit([X1, X2])
Source code in cca_zoo/tree/_treecca.py
def __init__(
    self,
    n_components: int = 1,
    *,
    center: bool = True,
    n_estimators: int | list[int] = 200,
    max_depth: int | list[int] = 3,
    learning_rate: float | list[float] = 0.1,
    subsample: float | list[float] = 0.8,
    colsample_bytree: float | list[float] = 0.8,
    min_child_weight: float | list[float] = 20,
    gauss_seidel: bool = True,
    random_state: int | None = None,
) -> None:
    super().__init__(n_components=n_components, center=center)
    self.n_estimators = n_estimators
    self.max_depth = max_depth
    self.learning_rate = learning_rate
    self.subsample = subsample
    self.colsample_bytree = colsample_bytree
    self.min_child_weight = min_child_weight
    self.gauss_seidel = gauss_seidel
    self.random_state = random_state

CatBoostCCA

CatBoostCCA(
    n_components: int = 1,
    *,
    center: bool = True,
    n_estimators: int | list[int] = 200,
    max_depth: int | list[int] = 3,
    learning_rate: float | list[float] = 0.1,
    subsample: float | list[float] = 0.8,
    colsample_bytree: float | list[float] = 0.8,
    min_child_weight: float | list[float] = 20,
    gauss_seidel: bool = True,
    random_state: int | None = None,
)

Bases: TreeCCA

:class:TreeCCA with CatBoost boosters.

Parameters and attributes are those of :class:TreeCCA. Requires catboost, in the tree extra. Slower per round than the other backends, since CatBoost rebuilds each booster to add a tree.

References

Chapman, J. (2026). TreeCCA: Canonical Correlation Analysis via Gradient-Boosted Trees. arXiv:2607.27027.

Examples:

>>> import numpy as np
>>> from cca_zoo.tree import CatBoostCCA
>>> rng = np.random.default_rng(0)
>>> X1 = rng.standard_normal((100, 5))
>>> X2 = rng.standard_normal((100, 5))
>>> model = CatBoostCCA(n_components=2, n_estimators=10).fit([X1, X2])
Source code in cca_zoo/tree/_treecca.py
def __init__(
    self,
    n_components: int = 1,
    *,
    center: bool = True,
    n_estimators: int | list[int] = 200,
    max_depth: int | list[int] = 3,
    learning_rate: float | list[float] = 0.1,
    subsample: float | list[float] = 0.8,
    colsample_bytree: float | list[float] = 0.8,
    min_child_weight: float | list[float] = 20,
    gauss_seidel: bool = True,
    random_state: int | None = None,
) -> None:
    super().__init__(n_components=n_components, center=center)
    self.n_estimators = n_estimators
    self.max_depth = max_depth
    self.learning_rate = learning_rate
    self.subsample = subsample
    self.colsample_bytree = colsample_bytree
    self.min_child_weight = min_child_weight
    self.gauss_seidel = gauss_seidel
    self.random_state = random_state