Compare commits

...

4 Commits

Author SHA1 Message Date
Tomasz Łysiak
104dc6916d plot generator 2019-05-16 12:49:19 +02:00
Tomasz Łysiak
bb573bf09a plot generator 2019-05-16 12:38:06 +02:00
Tomasz Łysiak
0a710fb27e plot generator 2019-05-16 12:32:08 +02:00
Tomasz Łysiak
ec71cbfa78 new plot branch 2019-05-16 10:33:28 +02:00
6 changed files with 40 additions and 63 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
.idea/
historical_wer_mean_plot.png
historical_srr_plot.png

15
Jenkinsfile vendored
View File

@ -5,20 +5,15 @@ pipeline {
steps { steps {
script { script {
step ([$class: 'CopyArtifact', step ([$class: 'CopyArtifact',
projectName: 'ASR-eval', projectName: 's407259-metrics',
target: 'Infra']); target: 's407259-matrics-data']);
sh 'git --version' sh 'git --version'
sh 'git checkout' sh 'git checkout'
sh 'python3 script.py' sh 'python3 generate_plot.py'
archiveArtifacts artifacts: 'num_lines.txt' archiveArtifacts artifacts: 'historical_srr_plot.png'
sh 'sudo python3 calculate_metrics.py' archiveArtifacts artifacts: 'historical_wer_mean_plot.png'
archiveArtifacts artifacts: 'wikiniews_results_with_wer.tsv'
archiveArtifacts artifacts: 'wer_mean.txt'
archiveArtifacts artifacts: 'srr.txt'
archiveArtifacts artifacts: 'historical_wer_mean.txt'
archiveArtifacts artifacts: 'historical_srr.txt'
} }
} }

View File

@ -1,39 +0,0 @@
import pandas as pd
from jiwer import wer
df_data = pd.read_csv('./Infra/wikiniews_results.tsv', sep='\t', index_col=False, header=None,
skip_blank_lines=False, keep_default_na=False, names=[1,2,3,4,5])
correct_answers = 0
for index, row in df_data.iterrows():
wer_result = wer(row[2], row[3])
df_data.loc[index, 5] = wer_result
if wer_result == 0.0:
correct_answers += 1
wer_mean = df_data[5].mean()
print(wer_mean)
srr = (correct_answers*1)/len(df_data)
print(srr)
df_data.to_csv('./wikiniews_results_with_wer.tsv',sep='\t', header=None)
with open("wer_mean.txt", "w") as text_file:
text_file.write(str(df_data[5].mean()))
with open("srr.txt", "w") as text_file:
text_file.write(str(srr))
with open("historical_wer_mean.txt", "a") as text_file:
text_file.write(str(df_data[5].mean()) + '\n')
with open("historical_srr.txt", "a") as text_file:
text_file.write(str(srr) + '\n')

31
generate_plot.py Normal file
View File

@ -0,0 +1,31 @@
import pandas as pd
from matplotlib.ticker import MaxNLocator
data = pd.read_csv('./s407259-matrics-data/historical_wer_mean.txt', header=None)
plot = data.tail(50).plot()
plot.xaxis.set_major_locator(MaxNLocator(integer=True))
plot.get_legend().remove()
plot.set_xlabel('sample')
plot.set_ylabel('wer')
plot.get_figure().savefig('./historical_wer_mean_plot')
data = pd.read_csv('./s407259-matrics-data/historical_srr.txt', header=None)
plot = data.tail(50).plot()
plot.xaxis.set_major_locator(MaxNLocator(integer=True))
plot.get_legend().remove()
plot.set_xlabel('sample')
plot.set_ylabel('srr')
plot.get_figure().savefig('./historical_srr_plot')

View File

@ -1,2 +1,2 @@
pandas pandas
jiwer matplotlib

View File

@ -1,13 +0,0 @@
print('starting 2')
import sys
from importlib import reload
import os
reload(sys)
num_lines = os.popen('wc -l ./Infra/wikiniews_results.tsv').read()
print('lines number')
print(num_lines)
file = open('num_lines.txt', 'w')
file.write(str(num_lines))
file.close()