Mercurial > hg > aimc
diff trunk/experiments/scripts/cnbh-syllables/results_plotting/plot_munged_results.py @ 440:99f9bf0f7798
- AIMC format file output
author | tom@acousticscale.org |
---|---|
date | Thu, 04 Nov 2010 19:48:53 +0000 |
parents | 1402e0d3c064 |
children |
line wrap: on
line diff
--- a/trunk/experiments/scripts/cnbh-syllables/results_plotting/plot_munged_results.py Thu Nov 04 19:04:35 2010 +0000 +++ b/trunk/experiments/scripts/cnbh-syllables/results_plotting/plot_munged_results.py Thu Nov 04 19:48:53 2010 +0000 @@ -4,12 +4,11 @@ """ +import matplotlib as mpl +mpl.use('PDF') import numpy as np import pylab as p -import matplotlib as mpl -mpl.use('PDF') -import matplotlib.pyplot as plt - +#import matplotlib.pyplot as plt f=open("results_test_all.csv","r") results = dict() @@ -24,30 +23,35 @@ 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]) 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]].append((values[1],values[2],values[2],values[4])) -ax = plt.subplot(111) - +ax = mpl.pyplot.subplot(111) train_set = 'inner' -lines = [] -labels = [] -hmm_iterations = 2 -hmm_states = 4 -hmm_components = 4 -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][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) -p.legend(lines, labels, 'upper left', shadow=True) -p.xlabel('SNR/dB') -p.ylabel('Recognition performance %') -plt.savefig(output_file) +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