diff --git a/Jenkinsfile_evaluation b/Jenkinsfile_evaluation index b3bccb8..9698f44 100644 --- a/Jenkinsfile_evaluation +++ b/Jenkinsfile_evaluation @@ -23,7 +23,7 @@ pipeline { } post { success { - archiveArtifacts artifacts: 'metrics.csv', followSymlinks: false + archiveArtifacts artifacts: 'metrics.*', followSymlinks: false } always { emailext body: "${currentBuild.currentResult}", subject: 's444507-evaluation', to: 'e19191c5.uam.onmicrosoft.com@emea.teams.ms' diff --git a/lab06_evaluation.py b/lab06_evaluation.py index 3ac9a14..f511246 100644 --- a/lab06_evaluation.py +++ b/lab06_evaluation.py @@ -11,6 +11,8 @@ from csv import DictWriter import torch.nn.functional as F import sys import os +import matplotlib.pyplot as plt +import json class Model(nn.Module): def __init__(self, input_dim): @@ -66,6 +68,18 @@ def print_metrics(test_labels, predictions): print(e) +def draw_plot(): + metrics = pd.read_csv('metrics_new.csv', delimiter=',', header=None) + build_axis = metrics[0][:] + plt.xlabel('Build') + plt.ylabel('Score') + plt.plot(build_axis, metrics[2][:], label='Accuracy') + plt.plot(build_axis, metrics[1][:], label='F1 Score') + plt.legend() + plt.show() + plt.savefig('metrics.png') + + model = torch.load("CarPrices_pytorch_model.pkl") cars_dev = pd.read_csv('./Car_Prices_Poland_Kaggle_dev.csv', usecols=[1, 4, 5, 6, 10], sep=',', names=[str(i) for i in range(5)]) cars_dev = cars_dev.loc[(cars_dev['0'] == 'audi') | (cars_dev['0'] == 'bmw') | (cars_dev['0'] == 'ford') | (cars_dev['0'] == 'opel') | (cars_dev['0'] == 'volkswagen')] @@ -76,5 +90,7 @@ pred = model(x_test) pred = pred.detach().numpy() print_metrics(labels_test, pred) +draw_plot() +