# HG changeset patch # User tomwalters # Date 1288571460 0 # Node ID 90181ab320f03eced6a673113e6c35fc8838bb28 # Parent 976459a8f68b07fb3dc5c184c63265f6cbd25356 - Scripts for plotting summary performance graphs. diff -r 976459a8f68b -r 90181ab320f0 experiments/scripts/cnbh-syllables/results_plotting/plot_munged_results.py --- a/experiments/scripts/cnbh-syllables/results_plotting/plot_munged_results.py Tue Oct 26 16:48:03 2010 +0000 +++ b/experiments/scripts/cnbh-syllables/results_plotting/plot_munged_results.py Mon Nov 01 00:31:00 2010 +0000 @@ -4,11 +4,9 @@ """ -import matplotlib as mpl -mpl.use('PDF') import numpy as np import pylab as p -#import matplotlib.pyplot as plt +import matplotlib.pyplot as plt f=open("results_test_all.csv","r") results = dict() @@ -18,40 +16,29 @@ results.setdefault(values[3],dict()) results[values[3]].setdefault(values[0], dict()) results[values[3]][values[0]].setdefault(values[1], dict()) - results[values[3]][values[0]][values[1]].setdefault(int(values[4]), dict()) - results[values[3]][values[0]][values[1]][int(values[4])].setdefault(int(values[5]), dict()) - results[values[3]][values[0]][values[1]][int(values[4])][int(values[5])].setdefault(int(values[6]), dict()) if values[2] == 'clean': - snr = 50 - results[values[3]][values[0]][values[1]][int(values[4])][int(values[5])][int(values[6])][snr] = float(values[7]) + snr = 40 else: snr = int(values[2]) - results[values[3]][values[0]][values[1]][int(values[4])][int(values[5])][int(values[6])][snr] = float(values[7]) + results[values[3]][values[0]][values[1]][snr] = float(values[4]) # results[values[3]].append((values[1],values[2],values[2],values[4])) -ax = mpl.pyplot.subplot(111) +ax = plt.subplot(111) + train_set = 'inner' -for hmm_iterations in [2,3,15]: - for hmm_states in [3,4]: - for hmm_components in [3,4]: - lines = [] - labels = [] - ax.cla() - for feature_type in ('mfcc', 'mfcc_vtln', 'aim'): - for feature_subtype in results[train_set][feature_type].keys(): - try: - this_line = results[train_set][feature_type][feature_subtype][hmm_states][hmm_components][hmm_iterations].items() - this_line.sort(cmp=lambda x,y: x[0] - y[0]) - xs, ys = zip(*this_line) - xs = list(xs) - ys = list(ys) - line, = ax.plot(xs,ys,'-o',linewidth=2) - lines.append(line) - labels.append(feature_type + "_" + feature_subtype) - except KeyError: - print "Data not found" - p.legend(lines, labels, 'upper left', shadow=True) - p.xlabel('SNR/dB') - p.ylabel('Recognition performance %') - output_file = ("recognition_vs_snr_%diterations_%dstates_%d_components.pdf" % (hmm_iterations, hmm_states, hmm_components)) - p.savefig(output_file) \ No newline at end of file +lines = [] +labels = [] +for feature_type in ('mfcc', 'mfcc_vtln', 'aim'): + for feature_subtype in results[train_set][feature_type].keys(): + this_line = results[train_set][feature_type][feature_subtype].items() + this_line.sort(cmp=lambda x,y: x[0] - y[0]) + xs, ys = zip(*this_line) + xs = list(xs) + ys = list(ys) + line, = ax.plot(xs,ys,'-o',linewidth=2) + lines.append(line) + labels.append(feature_type + "_" + feature_subtype) +p.legend(lines, labels, 'upper left', shadow=True) +p.xlabel('SNR/dB') +p.ylabel('Recognition performance %') +plt.show()