[P/M/K] How to see correlation when variables are more or less

How to see correlation when variables are more or less

Sometimes when we are doing prediction,we have to see the correlation between target and other variables. When the variables are not too many,we can build a corrmap and see it directly. But when variables are more than 20,it doesn’t work well.

less

sns.heatmap(train.corr(),annot=True,cmap='RdYlGn',linewidths=0.2)
fig=plt.gcf()
fig.set_size_inches(30,20)
plt.show()

more

correlation = train.corr()
correlation = correlation['Target'].sort_values(ascending=False)
print(f'The most 20 positive feature: \n{correlation.head(20)}')

from D:\KAGGLE\A Song of Ice and Fire\ASoIaF_take 3(prediction).py

猜你喜欢

转载自blog.csdn.net/qq_40820196/article/details/82426509
今日推荐