Hi Dai,

CCA finds the vectors in x space and Y space that maximizes the correlation
corr(u' X, v' Y), and continues finding such vectors under the constrain
that (u_i)_i, (v_i)_i are orthogonal.

As in your case dim Y = 1, you can only set n_components = 1: the vector v
will be [1], and u will be the linear combination u that maximizes corr(u'
X, Y). I guess it should be in the doc.

You cannot find more than one pair of vector (u, v) as v is already a basis
of Y space. Y variability is entirely explained with (u, v) only, hence the
warning.
Le 20 oct. 2015 06:52, "Dai Yan" <kanshu...@gmail.com> a écrit :

> Hello,
>
>
> I hope use CCA(Canonical Correlation Analysis)  to fit problem set with
> size of (35000, 117) to its label (35000, 1), 35000 is samples and 117 is
> feature dimension per sample.
>
> Now I have the following two problems.
>
> 1) How to choose appropriate CCA n_compoents parameter to fix my samples?
>
>
>
> 2) When classifying with n_components = 1 or n_components = 2, the fit
> procedure quits with the following messages,
>
> /usr/local/lib/python2.7/dist-packages/sklearn/cross_decomposition/pls_.py:277:
> UserWarning: Y residual constant at iteration 1
>   warnings.warn('Y residual constant at iteration %s' % k)
>
> And here I paste some of my codes to show CCA initialization parameters.
>
> *cca = CCA(max_iter=500000, tol=1e-05)*
> *cca.fit(features, labels) # features.shape = [35000, 117], labels =
> [35000, 1]*
>
>
> Could you give me some hints on this?
>
>
> Thanks,
>
> Yan
>
>
>
>
>
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Scikit-learn-general mailing list
> Scikit-learn-general@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>
>
------------------------------------------------------------------------------
_______________________________________________
Scikit-learn-general mailing list
Scikit-learn-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to