我在一个数据框中有太多的功能。我试图只画出在某个阈值上相关的特征,比如说超过80%,并在热图中显示这些特征。我把一些代码放在一起运行,但我仍然看到一些白线,它们没有数据,因此没有相关性。此外,我看到的东西,是远远低于80%的相关性。这是我试过的代码
import seaborn
c = newdf.corr()
plt.figure(figsize=(10,10))
seaborn.heatmap(c, cmap='RdYlGn_r', mask = (np.abs(c) >= 0.8))
plt.show()
当我运行它时,我看到了这个
这里怎么了
我正在做一个小的更新,有一些新的发现
这只会得到corr>;。8.
corr = newdf.corr()
kot = corr[corr>=.8]
plt.figure(figsize=(12,8))
sns.heatmap(kot, cmap="Reds")
这似乎有效,但它仍然给我很多白色!我认为应该有一种方法,只包括在一定数量上具有相关性的项目。也许您必须使用>;复制这些项目;。将8项添加到新的数据框中,并建立该对象的相关性。我不知道这是怎么回事
以下代码将强相关特征(相关度大于0.8)分组为组件,并分别绘制每组组件的相关性。如果与您想要的不同,请告诉我
相关问题 更多 >
编程相关推荐