Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
104dc6916d | ||
![]() |
bb573bf09a | ||
![]() |
0a710fb27e | ||
![]() |
ec71cbfa78 |
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
.idea/
|
||||
historical_wer_mean_plot.png
|
||||
historical_srr_plot.png
|
15
Jenkinsfile
vendored
15
Jenkinsfile
vendored
@ -5,20 +5,15 @@ pipeline {
|
||||
steps {
|
||||
script {
|
||||
step ([$class: 'CopyArtifact',
|
||||
projectName: 'ASR-eval',
|
||||
target: 'Infra']);
|
||||
projectName: 's407259-metrics',
|
||||
target: 's407259-matrics-data']);
|
||||
|
||||
|
||||
sh 'git --version'
|
||||
sh 'git checkout'
|
||||
sh 'python3 script.py'
|
||||
archiveArtifacts artifacts: 'num_lines.txt'
|
||||
sh 'sudo python3 calculate_metrics.py'
|
||||
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'
|
||||
sh 'python3 generate_plot.py'
|
||||
archiveArtifacts artifacts: 'historical_srr_plot.png'
|
||||
archiveArtifacts artifacts: 'historical_wer_mean_plot.png'
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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
31
generate_plot.py
Normal 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')
|
@ -1,2 +1,2 @@
|
||||
pandas
|
||||
jiwer
|
||||
matplotlib
|
13
script.py
13
script.py
@ -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()
|
Loading…
Reference in New Issue
Block a user