説明なし

plotFscore.py 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import matplotlib.pyplot as plt
  2. import numpy as np
  3. import pickle
  4. listOfFeatures=[['r1 s1'], ['r1 s4'], ['r1 s5'], ['r1 s1','r1 s4'], ['r1 s1','r1 s5'], ['r1 s4','r1 s5'], ['r1 s1','r1 s4','r1 s5'] ]
  5. featureNames={}
  6. featureNames['r1 s1']='$T_{evap}$'
  7. featureNames['r1 s4']='$T_{cond}$'
  8. featureNames['r1 s5']='$T_{air}$'
  9. featureNames['pa1 apiii']='$P_{elec}$'
  10. def listToString(l):
  11. r=''
  12. for i in l:
  13. r+=str(i)
  14. return(r.replace(' ',''))
  15. FS=[]
  16. for l in listOfFeatures:
  17. print(l)
  18. file = open('FScore'+listToString(l)+'.pk', 'rb')
  19. FS.append(pickle.load(file))
  20. file.close()
  21. plt.rcParams.update({'font.size': 16})
  22. fig, axes = plt.subplots(nrows=2, ncols=2, figsize=(14, 10), dpi=80, facecolor="w", edgecolor="k",sharex=True)
  23. tsToPlot=[4,8,12,16]
  24. for row in range(2):
  25. for col in range(2):
  26. ind=row*2+col
  27. for k in range(len(FS)):
  28. ar=np.array((FS[k][tsToPlot[ind]]))
  29. s='['
  30. for i in range(len(listOfFeatures[k])):
  31. s+=featureNames[listOfFeatures[k][i]]
  32. if i < len(listOfFeatures[k])-1:
  33. s+=', '
  34. s+=']'
  35. axes[row][col].plot(ar[:,0],ar[:,1],label=s,linewidth=3)
  36. #axes.set_xlabel("Threshold factor")
  37. if col==0:
  38. axes[row][col].set_ylabel("FScore")
  39. if row==1:
  40. axes[row][col].set_xlabel("Threshold Factor ($TF$)")
  41. axes[row][col].grid()
  42. axes[row][col].set_title('$ns=$'+str(tsToPlot[ind]))
  43. axes[0][0].legend(loc='lower right')
  44. #plt.title(str(features))
  45. plt.show()

Powered by TurnKey Linux.