Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CCA results do not match sklearn.cross_decomposition.CCA #220

Open
minimrbanana opened this issue Aug 24, 2023 · 1 comment
Open

CCA results do not match sklearn.cross_decomposition.CCA #220

minimrbanana opened this issue Aug 24, 2023 · 1 comment

Comments

@minimrbanana
Copy link

Hello,

When using CCA, we (@trappmartin and I) tried to reproduce the results from sklearn.cross_decomposition.CCA

>>> from sklearn.cross_decomposition import CCA
>>> X = [[0., 0., 1.], [1.,0.,0.], [2.,2.,2.], [3.,5.,4.]]
>>> Y = [[0.1, -0.2], [0.9, 1.1], [6.2, 5.9], [11.9, 12.3]]
>>> cca = CCA(n_components=1)
>>> cca.fit(X, Y)
CCA(n_components=1)
>>> X_c, Y_c = cca.transform(X, Y)
>>> X_c
array([[-1.3373174 ],
       [-1.10847164],
       [ 0.40763151],
       [ 2.03815753]])

with the following

julia> Y = reduce(hcat, [[0.1, -0.2], [0.9, 1.1], [6.2, 5.9], [11.9, 12.3]])
julia> X = reduce(hcat, [[0., 0., 1.], [1.,0.,0.], [2.,2.,2.], [3.,5.,4.]])
julia> m = fit(CCA, X, Y; outdim=1)
CCA (xindim = 3, yindim = 2, outdim = 1)
julia> xtransform(m, X)
1×4 Matrix{Float64}:
 0.867677  0.678174  -0.228687  -1.31716

but found out that the results do not match.
We could not figure out if it is due to our code or the package.
Is there a way to reproduce the results from sklearn?

@trappmartin
Copy link

Any suggestions how to ensure that CCA returns the same result as the sklearn implementation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants