Showing
31 changed files
with
31 additions
and
6 deletions

194 KB
... | @@ -4,6 +4,9 @@ from collections import defaultdict as df | ... | @@ -4,6 +4,9 @@ from collections import defaultdict as df |
4 | import os | 4 | import os |
5 | import random | 5 | import random |
6 | from pandas import DataFrame as DF | 6 | from pandas import DataFrame as DF |
7 | +#from seaborn import heatmap | ||
8 | +import numpy as np | ||
9 | +import numpy.random | ||
7 | import matplotlib.pyplot as plt | 10 | import matplotlib.pyplot as plt |
8 | 11 | ||
9 | # Objective | 12 | # Objective |
... | @@ -108,10 +111,26 @@ if __name__ == '__main__': | ... | @@ -108,10 +111,26 @@ if __name__ == '__main__': |
108 | fscore[k].append(float(tags[k][2])) | 111 | fscore[k].append(float(tags[k][2])) |
109 | #support[k].append(tags[k][3]) | 112 | #support[k].append(tags[k][3]) |
110 | print(DF(precision)) | 113 | print(DF(precision)) |
111 | - print(precision) | 114 | + #================================HEATMAP================================# |
115 | + ''' | ||
116 | + plt.clf() | ||
117 | + plt.title('Precision score by tag heatmap') | ||
118 | + plt.ylabel('runs') | ||
119 | + plt.xlabel('tags') | ||
120 | + plt.imshow(DF(precision)) | ||
121 | + plt.show() | ||
122 | + | ||
123 | + | ||
124 | + imageName = str(os.path.join(options.outputPath, options.figureName)) + '_heatmap_' + str(options.version) | ||
125 | + fig = plt.figure() | ||
126 | + heatmap(DF(precision)) | ||
127 | + fig.savefig(imageName, bbox_inches='tight', pad_inches = 0.5) | ||
128 | + ''' | ||
129 | + #print(precision) | ||
112 | #lines = ['-', '--', '-.', ':', '.', ',', 'o', 'v', '^', '<', '>', '1', '2', '3', '4', 's', 'p', '*', 'h', 'H', '+', 'x', 'D', 'd', '|', '_'] | 130 | #lines = ['-', '--', '-.', ':', '.', ',', 'o', 'v', '^', '<', '>', '1', '2', '3', '4', 's', 'p', '*', 'h', 'H', '+', 'x', 'D', 'd', '|', '_'] |
131 | + #================================SINGLE PLOT================================ | ||
113 | lines = ['-','--','-.',':','o','v','^','<','>','s','p','*','H','+','x','D','|'] | 132 | lines = ['-','--','-.',':','o','v','^','<','>','s','p','*','H','+','x','D','|'] |
114 | - imageName = str(options.figureName) + '_' + str(options.version) | 133 | + imageName = str(os.path.join(options.outputPath, options.figureName)) + '_' + str(options.version) |
115 | fig = plt.figure() | 134 | fig = plt.figure() |
116 | plt.rcParams.update({'font.size': 15}) | 135 | plt.rcParams.update({'font.size': 15}) |
117 | fig.set_figheight(13) | 136 | fig.set_figheight(13) |
... | @@ -124,13 +143,16 @@ if __name__ == '__main__': | ... | @@ -124,13 +143,16 @@ if __name__ == '__main__': |
124 | lines = [ 'r--', 'r-.', 'r:', 'g--', 'g-.', 'g:', 'b--', 'b-.', 'b:' , 'm--', 'm-.', 'm:', 'c--', 'c-.', 'c:'] | 143 | lines = [ 'r--', 'r-.', 'r:', 'g--', 'g-.', 'g:', 'b--', 'b-.', 'b:' , 'm--', 'm-.', 'm:', 'c--', 'c-.', 'c:'] |
125 | for i,k in enumerate(tags.keys()): | 144 | for i,k in enumerate(tags.keys()): |
126 | plt.grid(False) | 145 | plt.grid(False) |
127 | - plt.plot(precision[k], lines[i], label=k, linewidth=(15-i)*2) | 146 | + plt.plot(precision[k], lines[i], label=k, linewidth=4) |
147 | + for a,b in zip(range(8), precision[k]): | ||
148 | + plt.text(a, b+0.03, str(b), fontsize=10) | ||
149 | + | ||
128 | plt.legend(loc='lower right') | 150 | plt.legend(loc='lower right') |
129 | plt.tight_layout() | 151 | plt.tight_layout() |
130 | plt.xticks(range(8),['run1', 'run2', 'run3', 'run4', 'run5', 'run6', 'run7', 'run8']) | 152 | plt.xticks(range(8),['run1', 'run2', 'run3', 'run4', 'run5', 'run6', 'run7', 'run8']) |
131 | fig.savefig(imageName, bbox_inches='tight', pad_inches = 0.5) | 153 | fig.savefig(imageName, bbox_inches='tight', pad_inches = 0.5) |
132 | 154 | ||
133 | - imageName = str(options.figureName) + '_variants_' + str(options.version) | 155 | + imageName = str(os.path.join(options.outputPath, options.figureName)) + '_variants_' + str(options.version) |
134 | fig = plt.figure() | 156 | fig = plt.figure() |
135 | plt.rcParams.update({'font.size': 15}) | 157 | plt.rcParams.update({'font.size': 15}) |
136 | fig.set_figheight(13) | 158 | fig.set_figheight(13) |
... | @@ -138,11 +160,14 @@ if __name__ == '__main__': | ... | @@ -138,11 +160,14 @@ if __name__ == '__main__': |
138 | plt.xlabel("Runs") | 160 | plt.xlabel("Runs") |
139 | plt.ylabel("score") | 161 | plt.ylabel("score") |
140 | plt.ylim(0.4, 1.2) | 162 | plt.ylim(0.4, 1.2) |
141 | - variantTags = [k for k in tags.keys() if len(set(tags[k]))>1 ] | 163 | + variantTags = [k for k in tags.keys() if len(set(tags[k]))>2 ] |
142 | #lines = [ 'r^', 'ro', 'g^', 'go', 'b^', 'bo' , 'm^', 'mo', 'c^', 'co', 'ch', 'rh', 'gh', 'bh','mh'] | 164 | #lines = [ 'r^', 'ro', 'g^', 'go', 'b^', 'bo' , 'm^', 'mo', 'c^', 'co', 'ch', 'rh', 'gh', 'bh','mh'] |
165 | + lines = ['r--', 'g--', 'b--', 'm--', 'c--', 'r-.', 'g-.', 'b-.', 'm-.', 'c-.', 'r:', 'g:', 'b:' , 'm:', 'c:'] | ||
143 | for i,k in enumerate(variantTags): | 166 | for i,k in enumerate(variantTags): |
144 | plt.grid(False) | 167 | plt.grid(False) |
145 | - plt.plot(precision[k], lines[i], label=k, linewidth=(15-i)*2) | 168 | + plt.plot(precision[k], lines[i], label=k, linewidth=4) |
169 | + for a,b in zip(range(8), precision[k]): | ||
170 | + plt.text(a, b+0.03, str(b), fontsize=10) | ||
146 | plt.legend(loc='lower right') | 171 | plt.legend(loc='lower right') |
147 | plt.tight_layout() | 172 | plt.tight_layout() |
148 | plt.xticks(range(8),['run1', 'run2', 'run3', 'run4', 'run5', 'run6', 'run7', 'run8']) | 173 | plt.xticks(range(8),['run1', 'run2', 'run3', 'run4', 'run5', 'run6', 'run7', 'run8']) | ... | ... |

123 KB
CRF/figures/FiguresGrid_sep17_v11.png
0 → 100644

184 KB

176 KB
-
Please register or login to post a comment