-
-
Notifications
You must be signed in to change notification settings - Fork 26.5k
Closed
Labels
DocumentationEasyWell-defined and straightforward way to resolveWell-defined and straightforward way to resolve
Description
Description
I think when the number of features is bigger than number of samples the maximum number of components scikit learn pca will return is equal to number of samples
Steps/Code to Reproduce
import numpy as np
from sklearn.decomposition import PCA
import pandas as pd
X = np.array([[-1, -1,3,4,-1, -1,3,4], [-2, -1,5,-1, -1,3,4,2], [-3, -2,1,-1, -1,3,4,1],
[1, 1,4,-1, -1,3,4,2], [2, 1,0,-1, -1,3,4,2], [3, 2,10,-1, -1,3,4,10]])
ipca = PCA(n_components = 7)
print (X.shape)
ipca.fit(X)
result = ipca.transform(X)
print (result.shape);
Expected Results
(6*7)
Actual Results
(6*6)
Versions
Metadata
Metadata
Assignees
Labels
DocumentationEasyWell-defined and straightforward way to resolveWell-defined and straightforward way to resolve