How to use scikit-learn PCA for features reduction and know which features are discarded

前端 未结 3 1575
清歌不尽
清歌不尽 2021-01-30 17:37

I am trying to run a PCA on a matrix of dimensions m x n where m is the number of features and n the number of samples.

Suppose I want to preserve the nf fe

3条回答
  •  -上瘾入骨i
    2021-01-30 18:19

    The answer marked above is incorrect. The sklearn site clearly states that the components_ array is sorted. so it can't be used to identify the important features.

    components_ : array, [n_components, n_features] Principal axes in feature space, representing the directions of maximum variance in the data. The components are sorted by explained_variance_.

    http://scikit-learn.org/stable/modules/generated/sklearn.decomposition.PCA.html

提交回复
热议问题