Skip to content

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

@minimrbanana

Description

@minimrbanana

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions