From 15065514a9304aa795aeeee4dca83593416e79f5 Mon Sep 17 00:00:00 2001 From: Dawid Date: Mon, 10 May 2021 21:11:07 +0200 Subject: [PATCH] Added evaluation --- Jenkinsfile_evaluation | 41 +++++++++++++++++++++++++++++++++++++++++ tensor-eval.py | 21 +++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 Jenkinsfile_evaluation create mode 100644 tensor-eval.py diff --git a/Jenkinsfile_evaluation b/Jenkinsfile_evaluation new file mode 100644 index 0000000..066c982 --- /dev/null +++ b/Jenkinsfile_evaluation @@ -0,0 +1,41 @@ +pipeline { + agent {dockerfile true} + parameters { + buildSelector( + defaultSelector: lastSuccessful(), + description: 'Which build to use for copying artifacts', + name: 'BUILD_SELECTOR' + ) + buildSelector( + defaultSelector: lastSuccessful(), + description: 'Which build to use for copying artifacts', + name: 'WHICH_BUILD_TRAIN' + ) + } + stages { + stage('copyArtifacts') { + steps { + copyArtifacts fingerprintArtifacts: true, projectName: 's434804-create-dataset', selector: buildParameter('BUILD_SELECTOR') + copyArtifacts fingerprintArtifacts: true, projectName: 's434804-training/master', selector: buildParameter('WHICH_BUILD_TRAIN') + } + } + stage('evaluation') { + steps { + sh 'chmod +x tensor-eval.py' + sh 'python3 "tensor-eval.py" >> evaluation.txt' + } + } + stage('archiveArtifacts') { + steps{ + archiveArtifacts 'evaluation.txt' + } + } + stage('sendMail') { + steps{ + emailext body: currentBuild.result ?: 'EVALUATION SUCCESS', + subject: 's434804', + to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms' + } + } + } +} \ No newline at end of file diff --git a/tensor-eval.py b/tensor-eval.py new file mode 100644 index 0000000..a4cd9a3 --- /dev/null +++ b/tensor-eval.py @@ -0,0 +1,21 @@ +import numpy as np +import pandas as pd +from sklearn.linear_model import LinearRegression +from sklearn.model_selection import train_test_split +from sklearn.metrics import mean_squared_error as rmse + +reg = LinearRegression() + +alldata = pd.read_csv( + 'country_vaccinations.csv', header=0, skipinitialspace=True, + usecols=['total_vaccinations', 'people_vaccinated', 'daily_vaccinations' ,'daily_vaccinations_per_million']).dropna() + +X = alldata[[c for c in alldata.columns if c != 'daily_vaccinations']] +y = alldata['daily_vaccinations'] + +X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.2, random_state = 6) +lin_reg = reg.fit(X_train, y_train) +score = lin_reg.score(X_test, y_test) +prediction = lin_reg.predict(X_test) +print("RMSE:", rmse(y_test, prediction, squared=False)) +print("Score:", score) \ No newline at end of file