This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |