from sklearn.decomposition import PCA
pca = PCA(n_components=n) # 指定降维到n维
pca.fit(X) # 进行降维
print(pca.explained_variance_ratio_) # Percentage of variance explained by each of the selected components.
print(pca.singular_values_) # The singular values corresponding to each of the selected components.
【代码模版】sklearn实现PCA的基本过程
猜你喜欢
转载自blog.csdn.net/weixin_44680262/article/details/104719149
今日推荐
周排行