Why can't I use 2D-arrays as features for CCA (Canonical Correlation Analysis) classifier? The Problem
When using fit of the scikit learn CCA classifier it won't allow me to use arrays as features. The error ValueError: Found array with dim 3. Estimator expected &lt;= 2. can be produced whit the following code
from sklearn.cross_decomposition import CCA
    CCA_model = CCA(n_components = 3, max_iter=20000)
    
    input_arr = [[[k*-1+j*-i*-1 for k in range(125)] for j in range(2)] for i in range(189)]
    input_arr = np.array(input_arr)
    print(&quot;INPUT SHAPE:&quot;, input_arr.shape)
    input_lbl = [[(-(-1+(-1)**(1+k+j)))/2 for k in range(3)] for j in range(189)]
    input_lbl = np.array(input_lbl)
    print(&quot;LABEL SHAPE:&quot;, input_lbl.shape)

    model = CCA_model.fit(input_arr, input_lbl)


&gt;&gt;INPUT SHAPE: (189, 2, 125)
&gt;&gt;LABEL SHAPE: (189, 3)

The question
Why is it so, shouldn't it be allowed to use arrays as single features? Is there any parameter I need to modify to do this?
No, coding-wise, it cannot use multi-dimensional arrays as single features. You can flatten the array though. Essentially, you want to reshape your input to be (189, 250).