python - scikit learn PCA dimension reduction - data lot of features and few samples -


i trying dimension reduction using pca scikit-learn. data set has around 300 samples , 4096 features. want reduce dimensions 400 , 40. when call algorithm resulting data have @ "number of samples" features.

from sklearn.decomposition import pca  pca = pca(n_components = 400) traindata = pca.fit_transform(traindata) testdata = pca.transform(testdata) 

where initial shape of traindata 300x4096 , resulting data shape 300x300. there way perform operation on kind of data (lot of features, few samples)?

the maximum number of principal components can extracted , m x n dataset min(m, n). not algorithm issue. fundamentally, maximum number there are.


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -