In scikit-learn for Python, there is a module call cross_decomposition with a canonical correlation analysis (CCA) class. I have been trying to figure out how to give the c
Well, with some help looking at the source code in pyrcca I managed to create this snippet of code to get out the first canonical correlation.
cca = CCA(n_components=1)
U_c, V_c = cca.fit_transform(U, V)
result = np.corrcoef(U_c.T, V_c.T)[0,1]
Hope this helps someone else.
Note: The pyrcca package mentioned above runs slightly quicker than sci-kit learn's, due to heavier usage of multi-core processing for anyone who was curious. Also they have implemented kernel CCA unlike sklearn.