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