Add plot for evaluation, add parameters to jenkins and fix mail sending
This commit is contained in:
parent
703c27c5f6
commit
64e1ead5c5
@ -7,23 +7,32 @@ pipeline {
|
||||
defaultSelector: lastSuccessful(),
|
||||
description: 'Which build to use for copying artifacts',
|
||||
name: 'WHICH_BUILD_DATA'
|
||||
)
|
||||
buildSelector(
|
||||
)
|
||||
buildSelector(
|
||||
defaultSelector: lastSuccessful(),
|
||||
description: 'Which build to use for copying artifacts',
|
||||
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 {
|
||||
stage('checkout') {
|
||||
stage('copyArtifacts') {
|
||||
steps {
|
||||
copyArtifacts fingerprintArtifacts: true, projectName: 's430705-create-dataset', selector: buildParameter('WHICH_BUILD_DATA')
|
||||
copyArtifacts fingerprintArtifacts: true, projectName: 's430705-training/master', selector: buildParameter('WHICH_BUILD_TRAIN')
|
||||
copyArtifacts optional: true, fingerprintArtifacts: true, projectName: 's430705-evaluation/master', selector: buildParameter('WHICH_BUILD_EVAL')
|
||||
}
|
||||
}
|
||||
stage('Docker'){
|
||||
stage('Evaluation){
|
||||
steps{
|
||||
copyArtifacts fingerprintArtifacts: true, projectName: 's430705-training/master', selector: buildParameter('WHICH_BUILD_TRAIN')
|
||||
sh 'python3 "./lab06-eval.py" >> eval.txt'
|
||||
sh 'python3 "./lab06-eval.py ${WHICH_BUILD_TRAIN}"'
|
||||
sh 'python3 "./lab06-plot.py"'
|
||||
sh 'python3 "./lab07_sacred01.py"'
|
||||
sh 'python3 "./lab07_sacred02.py"'
|
||||
}
|
||||
@ -32,14 +41,22 @@ pipeline {
|
||||
steps {
|
||||
archiveArtifacts 'eval.txt'
|
||||
archiveArtifacts 'lab07/**'
|
||||
archiveArtifacts 'evaluation_plot.png'
|
||||
}
|
||||
}
|
||||
stage('sendMail') {
|
||||
steps{
|
||||
emailext body: currentBuild.result ?: 'SUCCESS EVALUATION',
|
||||
subject: 's430705 evaluation',
|
||||
to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms'
|
||||
}
|
||||
}
|
||||
post {
|
||||
success {
|
||||
mail body: 'SUCCESS', subject: 's430705', to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms'
|
||||
}
|
||||
unstable {
|
||||
mail body: 'UNSTABLE', subject: 's430705', to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms'
|
||||
}
|
||||
failure {
|
||||
mail body: 'FAILURE', subject: 's430705', to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms'
|
||||
}
|
||||
changed {
|
||||
mail body: 'CHANGED', subject: 's430705', to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms'
|
||||
}
|
||||
}
|
||||
}
|
@ -16,7 +16,7 @@ pipeline {
|
||||
stage('copyArtifacts') {
|
||||
steps {
|
||||
copyArtifacts fingerprintArtifacts: true, projectName: 's430705-create-dataset', selector: buildParameter('BUILD_SELECTOR')
|
||||
sh 'python3 lab06_training.py $epochs'
|
||||
sh 'python3 lab06_training.py ${epochs}'
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,6 +29,8 @@ pipeline {
|
||||
|
||||
post {
|
||||
success {
|
||||
|
||||
build job: 's430705-training/evaluation', parameters: ]
|
||||
mail body: 'SUCCESS',
|
||||
subject: 's430705',
|
||||
to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms'
|
||||
|
@ -1,22 +1,22 @@
|
||||
from tensorflow.keras.models import Sequential
|
||||
from tensorflow.keras.layers import Dense
|
||||
from tensorflow.keras.optimizers import Adam
|
||||
from tensorflow.keras.layers import Dropout
|
||||
from tensorflow.keras.callbacks import EarlyStopping
|
||||
from sklearn.metrics import mean_squared_error, mean_absolute_error, accuracy_score
|
||||
from tensorflow.keras.models import load_model
|
||||
import pandas as pd
|
||||
import sys
|
||||
|
||||
test_df = pd.read_csv('test.csv')
|
||||
import pandas as pd
|
||||
from sklearn.metrics import mean_squared_error
|
||||
from tensorflow.keras.models import load_model
|
||||
|
||||
test_df = pd.read_csv("test.csv")
|
||||
test_df.drop(test_df.columns[0], axis=1, inplace=True)
|
||||
x_test = test_df.drop("rating", axis=1)
|
||||
y_test = test_df["rating"]
|
||||
|
||||
model = Sequential()
|
||||
model = load_model('model_movies')
|
||||
|
||||
model = load_model("model_movies")
|
||||
y_pred = model.predict(x_test.values)
|
||||
|
||||
rmse = mean_squared_error(y_test, y_pred)
|
||||
build_number = sys.argv[1] if len(sys.argv) > 1 else 0
|
||||
|
||||
print(f"RMSE: {rmse}")
|
||||
d = {"rmse": [rmse], "build": [build_number]}
|
||||
df = pd.DataFrame(data=d)
|
||||
|
||||
with open("evaluation.csv", "a") as f:
|
||||
df.to_csv(f, header=f.tell() == 0, index=False)
|
||||
|
6
lab06-plot.py
Normal file
6
lab06-plot.py
Normal file
@ -0,0 +1,6 @@
|
||||
import pandas as pd
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
df = pd.read_csv("evaluation.csv")
|
||||
df.plot(x="build", y="rmse")
|
||||
plt.savefig("evaluation_plot.png")
|
@ -1,7 +1,7 @@
|
||||
import sys
|
||||
|
||||
import mlflow
|
||||
import pandas as pd
|
||||
|
||||
from sklearn.metrics import mean_squared_error
|
||||
from sklearn.model_selection import train_test_split
|
||||
from tensorflow.keras.callbacks import EarlyStopping
|
||||
|
@ -10,3 +10,4 @@ wget==3.2
|
||||
gast==0.3.3
|
||||
sacred==0.8.2
|
||||
GitPython==3.1.14
|
||||
matplotlib==3.4.2
|
Loading…
Reference in New Issue
Block a user