微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

PCA 可视化似乎过于密集

如何解决PCA 可视化似乎过于密集

谁能帮我解决这个问题?我不知道为什么我绘制它时数据会显示为这样。颜色要均匀分布。

enter image description here

这是我的代码

pca = myPCA(n_components = 5) # Conduct myPCA with 5 principal components.
pca.fit(X_train) # Calculate 5 principal components on the training dataset
X_train_pca = pca.transform(X_train)

X_train_pca.shape

import matplotlib.pyplot as plt
import seaborn as sns; sns.set()
figure = plt.figure(dpi=100)
plt.scatter(X_train_pca[:,0],X_train_pca[:,1],c=y_train,s=15,edgecolor='none',alpha=0.5,cmap=plt.cm.get_cmap('tab10',10))
plt.xlabel('component 1')
plt.ylabel('component 2')
plt.colorbar();

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。