add png plot
Some checks failed
s444507-evaluation/pipeline/head There was a failure building this commit
444507-training/pipeline/head This commit looks good

This commit is contained in:
Adam Wojdyla 2022-05-02 02:08:51 +02:00
parent 6207e95793
commit 8a163284e8
2 changed files with 17 additions and 1 deletions

View File

@ -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'

View File

@ -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()