on-internet
← Community

Measure of feature importance in PCA

Stack Overflow ·

I am doing principal component analysis (PCA), and I'd like to find out which features that contribute the most to the result. My intuition is to sum up all the absolute values of the individual contribution of the features to the individual components. import numpy as np from sklearn.decomposition import PCA X = np.array([[-1, -1, 4, 1], [-2, -1, 4, 2], [-3, -2, 4, 3], [1, 1, 4, 4], [2, 1, 4, 5], [3, 2, 4, 6]]) pca = PCA(n_components=0.95, whiten=True, svd_solver='full').fit(X) pca.components_ array([[ 0.71417303, 0.46711713, 0. , 0.52130459], [-0.46602418, -0.23839061, -0. , 0.85205128]]) np

Comments

Sign in or sign up to comment and upvote.

No comments yet.