首页 > 其他分享 >画热力图

画热力图

时间:2022-12-07 17:25:28浏览次数:32  
标签:df 力图 feature heat np label ds 画热

import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns df = pd.read_csv('train.csv') df=df.drop(['ID'],axis=1) heat=df.corr() fe=heat.index[abs(heat["CLASS"])>0.3] nmp=df.to_numpy() label=nmp[:,-1] feature=nmp[:,:-1] feature=np.abs(np.fft.fft(feature))/240*2 df = pd.read_csv('test.csv') df=df.drop(['ID'],axis=1) w=[4,8,10,12,14,16,18,20,22,24,26,28,30,32,36,40,44,48,76,84,88,92,132,140 ,144,148,152,160,164,168,192,196,200,204,206,208,210 ,212,216,224,226,232,236] label=np.reshape(label,(-1,1)) ds=np.concatenate((feature[:,w],label),axis=1) ds=pd.DataFrame(ds) heat=ds.corr() fe=heat.index[abs(heat[43])>0.1] q=[] for i in fe:     if i!=43:         q.append(w[i]) print(q)
sns.heatmap(heat[fe].corr(),square=True,annot=True) plt.show()

标签:df,力图,feature,heat,np,label,ds,画热
From: https://www.cnblogs.com/hahaah/p/16963664.html

相关文章