plotting and eval metrics
This commit is contained in:
parent
41c655024d
commit
0d495bc36f
20
JenkinsfileEval
Normal file
20
JenkinsfileEval
Normal file
@ -0,0 +1,20 @@
|
||||
node {
|
||||
stage('Preparation') {
|
||||
checkout scm
|
||||
copyArtifacts projectName: 's470618-metrics', filter: 'metrics.txt', fingerprintArtifacts: true, selector: lastSuccessful(), optional: true, target: './train-eval'
|
||||
copyArtifacts projectName: 's470618-training', filter: '*.pt', fingerprintArtifacts: true, selector: lastSuccessful(), target: '.'
|
||||
|
||||
stage('Evaluate metrics') {
|
||||
sh "pip install matplotlib"
|
||||
sh "cd train-eval && ./eval.py"
|
||||
sh "./plot_metrics.py"
|
||||
}
|
||||
}
|
||||
|
||||
stage('artifacts') {
|
||||
echo 'saving artifacts'
|
||||
archiveArtifacts 'metrics.txt', 'prediction.tsv', 'metrics.png'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ print ("The accuracy is", acc)
|
||||
print ("The precission score is ", prec)
|
||||
print ("The recall score is ", recall)
|
||||
|
||||
file = open('metrics.txt', 'w')
|
||||
file = open('metrics.txt', 'a')
|
||||
file.write(str(acc) + '\t' + str(prec) + '\t' + str(recall))
|
||||
file.close()
|
||||
|
||||
|
19
train-eval/plot_metrics.py
Executable file
19
train-eval/plot_metrics.py
Executable file
@ -0,0 +1,19 @@
|
||||
#!/usr/bin/python3
|
||||
import matplotlib
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
data = []
|
||||
with open('metrics.txt', 'r') as metrics:
|
||||
for line in metrics:
|
||||
data.append(line.strip().split('\t'))
|
||||
|
||||
|
||||
# print(acc)
|
||||
labels = ['accuracy','precision','recall']
|
||||
builds = [x for x in range(len(data))]
|
||||
fig = plt.figure()
|
||||
ax = fig.add_subplot(1,1,1)
|
||||
for i in range(3):
|
||||
ax.plot(builds, [data[x][i] for x in range(len(data))], label=labels[i])
|
||||
plt.legend()
|
||||
plt.savefig('metrics.png')
|
Loading…
Reference in New Issue
Block a user