This commit is contained in:
Alicja Szulecka 2024-04-30 16:25:37 +02:00
parent 65bf01c425
commit 520206ef22
3 changed files with 37 additions and 5 deletions

12
Jenkinsfile vendored
View File

@ -42,5 +42,17 @@ pipeline {
} }
} }
} }
stage('Plot Accuracy') {
steps {
script {
def customImage = docker.build("custom-image")
customImage.inside {
sh 'python3 ./plot.py'
archiveArtifacts artifacts: 'accuracy.png', onlyIfSuccessful: true
}
}
}
}
} }
} }

View File

@ -18,8 +18,7 @@ rmse = np.sqrt(mean_squared_error(true_labels, predicted_labels))
with open(r'metrics.txt', 'a') as fp: with open(r'metrics.txt', 'a') as fp:
fp.write(f"Accuracy: {accuracy}\n") fp.write(f"Accuracy: {accuracy}\n")
fp.write(f"Micro-average Precision: {precision_micro}\n") fp.write(f"Precision: {precision_micro}\n")
fp.write(f"Micro-average Recall: {recall_micro}\n") fp.write(f"Recall: {recall_micro}\n")
fp.write(f"Micro-average F1-score: {f1_micro}\n") fp.write(f"F1-score: {f1_micro}\n")
fp.write(f"RMSE: {rmse}\n") fp.write(f"RMSE: {rmse}\n")
fp.write("--------------------\n")

21
plot.py Normal file
View File

@ -0,0 +1,21 @@
import matplotlib.pyplot as plt
import numpy as np
accuracy = []
f = open("metrics.txt", "r")
for line in f:
parts = line.strip().split(' ')
if(parts[0] == 'Accuracy:'):
accuracy.append(float(parts[1]))
y_values = np.arange(1, len(accuracy) + 1)
plt.plot(y_values, accuracy, marker='o', linestyle='-', color='b')
plt.xlabel('Build Number')
plt.ylabel('Accuracy')
plt.title('Accuracy Plot')
plt.grid(True)
plt.show()
plt.savefig('accuracy.png')