I got this error n_components=1000 must be between 0 and min(n_samples, n_features)=2 with svd_solver='full'

Viewed 1837

I want to reduce the dimension of matrix of size (5,3844) using pca dimensionality reduction.I got this error n_components=1000 must be between 0 and min(n_samples, n_features)=2 with svd_solver='full'.

I am trying for more than 5 weeks to find how I can do it.

Any help would be appreciated.

coeffs = wavedec(y, 'sym5', level=5)
cA5,cD5,cD4,cD3,cD2,cD1=coeffs
result = []
    common_x = np.linspace(0,3844, len(cD1))
    for c in [cD5,cD4,cD3,cD2,cD1]:
        x = np.linspace(0, 3844, len(c))
        f = interp1d(x, c)
        result.append(f(common_x)) #(5,3844)
    pca = PCA(n_components=1000)
    pca.fit(result)
    data_pca = pca.transform(result)
    print("original shape:   ", result.shape) ##(5,3844)
    print("transformed shape:", data_pca.shape) 

0 Answers
Related