Skip to content

Instantly share code, notes, and snippets.

import numpy as np
from scipy.linalg import eigh
def cca_predict(X, Y, X_new, kx, ky, whitening=False):
"""
Canonical correlation analysis and prediction
Python version of the original R function at: https://github.com/jmhewitt/telefit/blob/master/R/cca.predict.R
:param X: training samples of the predictor with shape M1 x N (M1 variables, N observations)
:param Y: training samples of the predictand with shape M2 x N (M2 variables, N observations)
:param X_new: test samples of the predictor