Background
My system tries to classify among three classes. At first, my labeling for CCA had a single dimension {1, 2, 4}
, but then I found out that to get more components, I need more dimensions in Y: as dim Y = 1, I could only set n_components = 1.
So, I switched to OneHot labeling instead {[0 0 1],[0 1 0],[1 0 0]}
(dim Y = 3) and the CCA works fine with n_components <= 3
.
To improve my results (pretty mediocre right now), I tried increasing my number of components to at least the number of classes + 1. So I changed dim Y to 4: {[0 0 0 1],[0 0 1 0],[0 1 0 0]}
. Now I get this error randomly:
y_score = next(col for col in Y.T if np.any(np.abs(col) > eps))
which probably means "Yk is full of zeros, which means that Yk was successively deflated to a matrix of rank 0... which means that we asked for too many components, maybe?".
Question
Overall, I want to know how is the number of classes correlated to the number of components. Do I need to have n_components =< n_classes
? Can I increase my number of components without "deflating the martix to rank 0"?