Obtain eigen values and vectors from sklearn PCA

前端 未结 3 555
别跟我提以往
别跟我提以往 2021-01-29 23:56

How I can get the the eigen values and eigen vectors of the PCA application?

from sklearn.decomposition import PCA
clf=PCA(0.98,whiten=True)      #converse 98%          


        
3条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-30 00:41

    When you say "eigenvalues", do you mean the "singular values" for PCA? Eigenvalues are only possible when the matrix PCA applied on are square matrix.

    If you are trying to use "eigenvalues" to determine the proper dimension needed for PCA, you should actually use singular values. You can just use pca.singular_values_ to get the singular values.

提交回复
热议问题