s460929-metrics/script.py

37 lines
982 B
Python
Raw Permalink Normal View History

2020-04-10 18:54:50 +02:00
import matplotlib
from matplotlib import pyplot as plt
import csv
2020-04-10 19:05:07 +02:00
import os
2020-04-10 18:54:50 +02:00
probs = []
2020-04-10 19:05:07 +02:00
if os.path.exists('srr_results.txt') and os.path.exists('wer_results.txt'):
with open('srr_results.txt','r') as srr_in:
with open('wer_results.txt', 'r') as wrr_in:
wrr_reader = csv.reader(wrr_in, lineterminator='\n')
srr_reader = csv.reader(srr_in, lineterminator='\n')
counter = 0
wrr_scores = []
srr_scores = []
for wrr, srr in zip (wrr_reader, srr_reader):
wrr_scores.append(float(wrr[0]))
srr_scores.append(float(srr[0]))
counter+=1
2020-04-10 18:54:50 +02:00
2020-04-10 19:08:44 +02:00
for i in range(counter):
probs.append(i)
fig, ax = plt.subplots()
2020-04-10 19:38:04 +02:00
plt.xticks(probs)
2020-04-10 19:08:44 +02:00
plt.title("WER & SRR")
plt.xlabel("Number of probe")
plt.ylabel("Error value")
plt.plot(probs, wrr_scores)
plt.plot(probs, srr_scores)
ax.legend(["WER", "SRR"])
plt.savefig('plot.png')