comparison trunk/experiments/scripts/cnbh-syllables/results_plotting/plot_munged_results.py @ 423:b36762259dc6

- Scripts for plotting summary performance graphs.
author tomwalters
date Mon, 01 Nov 2010 00:31:00 +0000
parents
children f405ead2736f
comparison
equal deleted inserted replaced
422:ebed9c3fc63b 423:b36762259dc6
1 #!/usr/bin/python
2 """
3 plot_munged_results.py
4
5 """
6
7 import numpy as np
8 import pylab as p
9 import matplotlib.pyplot as plt
10
11 f=open("results_test_all.csv","r")
12 results = dict()
13 for line in f:
14 if line[0] != "#":
15 values = line.strip().split(",")
16 results.setdefault(values[3],dict())
17 results[values[3]].setdefault(values[0], dict())
18 results[values[3]][values[0]].setdefault(values[1], dict())
19 if values[2] == 'clean':
20 snr = 40
21 else:
22 snr = int(values[2])
23 results[values[3]][values[0]][values[1]][snr] = float(values[4])
24 # results[values[3]].append((values[1],values[2],values[2],values[4]))
25
26 ax = plt.subplot(111)
27
28 train_set = 'inner'
29 lines = []
30 labels = []
31 for feature_type in ('mfcc', 'mfcc_vtln', 'aim'):
32 for feature_subtype in results[train_set][feature_type].keys():
33 this_line = results[train_set][feature_type][feature_subtype].items()
34 this_line.sort(cmp=lambda x,y: x[0] - y[0])
35 xs, ys = zip(*this_line)
36 xs = list(xs)
37 ys = list(ys)
38 line, = ax.plot(xs,ys,'-o',linewidth=2)
39 lines.append(line)
40 labels.append(feature_type + "_" + feature_subtype)
41 p.legend(lines, labels, 'upper left', shadow=True)
42 p.xlabel('SNR/dB')
43 p.ylabel('Recognition performance %')
44 plt.show()