Estefani Gaytan Nunez

upload

Showing 31 changed files with 31 additions and 6 deletions
......@@ -4,6 +4,9 @@ from collections import defaultdict as df
import os
import random
from pandas import DataFrame as DF
#from seaborn import heatmap
import numpy as np
import numpy.random
import matplotlib.pyplot as plt
# Objective
......@@ -108,10 +111,26 @@ if __name__ == '__main__':
fscore[k].append(float(tags[k][2]))
#support[k].append(tags[k][3])
print(DF(precision))
print(precision)
#================================HEATMAP================================#
'''
plt.clf()
plt.title('Precision score by tag heatmap')
plt.ylabel('runs')
plt.xlabel('tags')
plt.imshow(DF(precision))
plt.show()
imageName = str(os.path.join(options.outputPath, options.figureName)) + '_heatmap_' + str(options.version)
fig = plt.figure()
heatmap(DF(precision))
fig.savefig(imageName, bbox_inches='tight', pad_inches = 0.5)
'''
#print(precision)
#lines = ['-', '--', '-.', ':', '.', ',', 'o', 'v', '^', '<', '>', '1', '2', '3', '4', 's', 'p', '*', 'h', 'H', '+', 'x', 'D', 'd', '|', '_']
#================================SINGLE PLOT================================
lines = ['-','--','-.',':','o','v','^','<','>','s','p','*','H','+','x','D','|']
imageName = str(options.figureName) + '_' + str(options.version)
imageName = str(os.path.join(options.outputPath, options.figureName)) + '_' + str(options.version)
fig = plt.figure()
plt.rcParams.update({'font.size': 15})
fig.set_figheight(13)
......@@ -124,13 +143,16 @@ if __name__ == '__main__':
lines = [ 'r--', 'r-.', 'r:', 'g--', 'g-.', 'g:', 'b--', 'b-.', 'b:' , 'm--', 'm-.', 'm:', 'c--', 'c-.', 'c:']
for i,k in enumerate(tags.keys()):
plt.grid(False)
plt.plot(precision[k], lines[i], label=k, linewidth=(15-i)*2)
plt.plot(precision[k], lines[i], label=k, linewidth=4)
for a,b in zip(range(8), precision[k]):
plt.text(a, b+0.03, str(b), fontsize=10)
plt.legend(loc='lower right')
plt.tight_layout()
plt.xticks(range(8),['run1', 'run2', 'run3', 'run4', 'run5', 'run6', 'run7', 'run8'])
fig.savefig(imageName, bbox_inches='tight', pad_inches = 0.5)
imageName = str(options.figureName) + '_variants_' + str(options.version)
imageName = str(os.path.join(options.outputPath, options.figureName)) + '_variants_' + str(options.version)
fig = plt.figure()
plt.rcParams.update({'font.size': 15})
fig.set_figheight(13)
......@@ -138,11 +160,14 @@ if __name__ == '__main__':
plt.xlabel("Runs")
plt.ylabel("score")
plt.ylim(0.4, 1.2)
variantTags = [k for k in tags.keys() if len(set(tags[k]))>1 ]
variantTags = [k for k in tags.keys() if len(set(tags[k]))>2 ]
#lines = [ 'r^', 'ro', 'g^', 'go', 'b^', 'bo' , 'm^', 'mo', 'c^', 'co', 'ch', 'rh', 'gh', 'bh','mh']
lines = ['r--', 'g--', 'b--', 'm--', 'c--', 'r-.', 'g-.', 'b-.', 'm-.', 'c-.', 'r:', 'g:', 'b:' , 'm:', 'c:']
for i,k in enumerate(variantTags):
plt.grid(False)
plt.plot(precision[k], lines[i], label=k, linewidth=(15-i)*2)
plt.plot(precision[k], lines[i], label=k, linewidth=4)
for a,b in zip(range(8), precision[k]):
plt.text(a, b+0.03, str(b), fontsize=10)
plt.legend(loc='lower right')
plt.tight_layout()
plt.xticks(range(8),['run1', 'run2', 'run3', 'run4', 'run5', 'run6', 'run7', 'run8'])
......