added plot and new parameters;change mail handling
Some checks failed
s434804-evaluation/pipeline/head There was a failure building this commit
Some checks failed
s434804-evaluation/pipeline/head There was a failure building this commit
This commit is contained in:
parent
af149190ea
commit
f1af6da7f1
@ -11,31 +11,46 @@ pipeline {
|
|||||||
description: 'Which build to use for copying artifacts',
|
description: 'Which build to use for copying artifacts',
|
||||||
name: 'WHICH_BUILD_TRAIN'
|
name: 'WHICH_BUILD_TRAIN'
|
||||||
)
|
)
|
||||||
|
buildSelector(
|
||||||
|
defaultSelector: lastSuccessful(),
|
||||||
|
description: 'Which build to use for copying artifacts',
|
||||||
|
name: 'WHICH_BUILD_EVAL'
|
||||||
|
)
|
||||||
|
gitParameter branchFilter: 'origin/(.*)', defaultValue: 'master', name: 'BRANCH', type: 'PT_BRANCH'
|
||||||
}
|
}
|
||||||
stages {
|
stages {
|
||||||
stage('copyArtifacts') {
|
stage('copyArtifacts') {
|
||||||
steps {
|
steps {
|
||||||
copyArtifacts fingerprintArtifacts: true, projectName: 's434804-create-dataset', selector: buildParameter('BUILD_SELECTOR')
|
copyArtifacts fingerprintArtifacts: true, projectName: 's434804-create-dataset', selector: buildParameter('BUILD_SELECTOR')
|
||||||
copyArtifacts fingerprintArtifacts: true, projectName: 's434804-training/master', selector: buildParameter('WHICH_BUILD_TRAIN')
|
copyArtifacts fingerprintArtifacts: true, projectName: 's434804-training/master', selector: buildParameter('WHICH_BUILD_TRAIN')
|
||||||
|
copyArtifacts optional: true, fingerprintArtifacts: true, projectName: 's434804-evaluation/master', selector: buildParameter('WHICH_BUILD_EVAL')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('evaluation') {
|
stage('evaluation') {
|
||||||
steps {
|
steps {
|
||||||
|
sh 'buildNumber=$(echo $BUILD_NUMBER)'
|
||||||
|
sh 'python3 ./lab06-eval.py $BUILD_NUMBER'
|
||||||
sh 'chmod +x tensor-eval.py'
|
sh 'chmod +x tensor-eval.py'
|
||||||
sh 'python3 "tensor-eval.py" >> evaluation.txt'
|
sh 'python3 "tensor-eval.py" >> evaluation.txt'
|
||||||
|
sh 'python3 tensor-plot.py'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('archiveArtifacts') {
|
stage('archiveArtifacts') {
|
||||||
steps{
|
steps{
|
||||||
archiveArtifacts 'evaluation.txt'
|
archiveArtifacts 'evaluation.txt'
|
||||||
|
archiveArtifacts 'evaluation_plot.png'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('sendMail') {
|
|
||||||
steps{
|
|
||||||
emailext body: currentBuild.result ?: 'EVALUATION SUCCESS',
|
|
||||||
subject: 's434804',
|
|
||||||
to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms'
|
|
||||||
}
|
}
|
||||||
|
post {
|
||||||
|
success {
|
||||||
|
mail body: 'SUCCESS', subject: 's434804', to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms'
|
||||||
|
}
|
||||||
|
failure {
|
||||||
|
mail body: 'FAILURE', subject: 's434804', to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms'
|
||||||
|
}
|
||||||
|
changed {
|
||||||
|
mail body: 'CHANGED', subject: 's434804', to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,21 +1,28 @@
|
|||||||
import numpy as np
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
import sys
|
||||||
from sklearn.linear_model import LinearRegression
|
from sklearn.linear_model import LinearRegression
|
||||||
from sklearn.model_selection import train_test_split
|
from sklearn.model_selection import train_test_split
|
||||||
from sklearn.metrics import mean_squared_error as rmse
|
from sklearn.metrics import mean_squared_error as rmse
|
||||||
|
|
||||||
reg = LinearRegression()
|
reg = LinearRegression()
|
||||||
|
|
||||||
alldata = pd.read_csv(
|
alldata = pd.read_csv(
|
||||||
'test.csv', header=0, skipinitialspace=True,
|
'test.csv', header=0,
|
||||||
usecols=['total_vaccinations', 'people_vaccinated', 'daily_vaccinations' ,'daily_vaccinations_per_million']).dropna()
|
usecols=['total_vaccinations', 'daily_vaccinations', 'people_fully_vaccinated']).dropna()
|
||||||
|
|
||||||
X = alldata[[c for c in alldata.columns if c != 'daily_vaccinations']]
|
X = alldata['total_vaccinations'].to_numpy().ravel().reshape(-1, 1)
|
||||||
y = alldata['daily_vaccinations']
|
y = alldata['daily_vaccinations'].to_numpy().ravel().reshape(-1, 1)
|
||||||
|
|
||||||
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.2, random_state = 6)
|
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)
|
lin_reg = reg.fit(X_train, y_train)
|
||||||
score = lin_reg.score(X_test, y_test)
|
score = lin_reg.score(X_test, y_test)
|
||||||
prediction = lin_reg.predict(X_test)
|
prediction = lin_reg.predict(X_test)
|
||||||
|
|
||||||
|
build_no = sys.argv[1] if len(sys.argv) > 1 else 0
|
||||||
|
data = {"rmse": [rmse], "build": [build_no]}
|
||||||
|
df = pd.DataFrame(data=data)
|
||||||
|
|
||||||
|
with open("evaluation.csv", "a") as f:
|
||||||
|
df.to_csv(f, header=f.tell() == 0, index=False)
|
||||||
|
|
||||||
print("RMSE:", rmse(y_test, prediction, squared=False))
|
print("RMSE:", rmse(y_test, prediction, squared=False))
|
||||||
print("Score:", score)
|
print("Score:", score)
|
6
tensor-plot.py
Normal file
6
tensor-plot.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import pandas as pd
|
||||||
|
from matplotlib import pyplot as plt
|
||||||
|
|
||||||
|
df = pd.read_csv("evaluation.csv")
|
||||||
|
df.plot(x="build", y="rmse")
|
||||||
|
plt.savefig("evaluation_plot.png")
|
Loading…
Reference in New Issue
Block a user