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