This commit is contained in:
michalzareba 2021-05-10 19:42:26 +02:00
parent 8892555d61
commit cdc3c79f36
2 changed files with 64 additions and 0 deletions

42
Jenkinsfile_evaluation Normal file
View File

@ -0,0 +1,42 @@
pipeline {
agent {
dockerfile true
}
parameters{
buildSelector(
defaultSelector: lastSuccessful(),
description: 'Which build to use for copying artifacts',
name: 'WHICH_BUILD_DATA'
)
buildSelector(
defaultSelector: lastSuccessful(),
description: 'Which build to use for copying artifacts',
name: 'WHICH_BUILD_TRAIN'
)
}
stages {
stage('checkout') {
steps {
copyArtifacts fingerprintArtifacts: true, projectName: 's430705-create-dataset', selector: buildParameter('WHICH_BUILD_DATA')
}
}
stage('Docker'){
steps{
copyArtifacts fingerprintArtifacts: true, projectName: 's430705-training/master', selector: buildParameter('WHICH_BUILD_TRAIN')
sh 'python3 "./lab06-eval.py" >> eval.txt'
}
}
stage('archiveArtifacts') {
steps {
archiveArtifacts 'eval.txt'
}
}
stage('sendMail') {
steps{
emailext body: currentBuild.result ?: 'SUCCESS EVALUATION',
subject: 's430705 evaluation',
to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms'
}
}
}
}

22
lab06-eval.py Normal file
View File

@ -0,0 +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
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')
y_pred = model.predict(x_test.values)
rmse = mean_squared_error(y_test, y_pred)
print(f"RMSE: {rmse}")