From 97681d967debaa688e73e0360c0ebef01d76eaa0 Mon Sep 17 00:00:00 2001 From: Adrian Charkiewicz Date: Sat, 7 May 2022 04:46:30 +0200 Subject: [PATCH] evaluation appends to csv --- Dockerfile | 1 + Jenkinsfile_evaluation | 4 ++-- evaluation.py | 14 +++++++++++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index e1d4373..504dd11 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,6 +13,7 @@ RUN pip3 install torch RUN pip3 install seaborn RUN pip3 install torchvision RUN pip3 install sklearn +RUN pip3 install csv # RUN python3 -m pip install kaggle RUN python3 -m pip install pandas RUN pip3 install matplotlib diff --git a/Jenkinsfile_evaluation b/Jenkinsfile_evaluation index 85ef402..b917043 100644 --- a/Jenkinsfile_evaluation +++ b/Jenkinsfile_evaluation @@ -37,8 +37,8 @@ pipeline { copyArtifacts projectName: 's444354-create-dataset' copyArtifacts projectName: 's444354-training/$TRAINING_BRANCH' sh 'python3 ./evaluation.py' - archiveArtifacts 'TRAIN_winequality-red.csv' - sh "ls -la" + archiveArtifacts 'eval.csv' + } } } diff --git a/evaluation.py b/evaluation.py index 75101a5..c9a0009 100644 --- a/evaluation.py +++ b/evaluation.py @@ -2,6 +2,7 @@ import pandas as pd import re from sklearn import metrics import numpy as np +import csv f = open("result.txt", "r") @@ -16,6 +17,13 @@ for x in f: list_result.append(result) list_predicted.append(predicted) -print("MAE: ", metrics.mean_absolute_error(list_result, list_predicted)) -print("MSE: ",metrics.mean_squared_error(list_result, list_predicted)) -print("RMSE: ",np.sqrt(metrics.mean_absolute_error(list_result, list_predicted))) \ No newline at end of file +metrics = metrics.mean_absolute_error(list_result, list_predicted), metrics.mean_squared_error(list_result, list_predicted),np.sqrt(metrics.mean_absolute_error(list_result, list_predicted)) +print("MAE: ", metrics[0]) +print("MSE: ",metrics[1]) +print("RMSE: ",metrics[2]) + + + +with open('eval.csv', 'a', newline='') as f: + writer = csv.writer(f) + writer.writerow((metrics[0],metrics[1], metrics[2]))