【代码模版】sklearn实现PCA的基本过程

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. 
发布了37 篇原创文章 · 获赞 0 · 访问量 1463

猜你喜欢

转载自blog.csdn.net/weixin_44680262/article/details/104719149