Added evaluation
This commit is contained in:
parent
801a2f1c8d
commit
584f623294
@ -17,5 +17,6 @@ WORKDIR /app
|
||||
COPY ./preparations.sh ./
|
||||
COPY ./preprocesing.py ./
|
||||
COPY ./training.py ./
|
||||
COPY ./evaluation.py ./
|
||||
|
||||
# CMD ./preparations.sh
|
||||
|
40
eval.Jenkinsfile
Normal file
40
eval.Jenkinsfile
Normal file
@ -0,0 +1,40 @@
|
||||
pipeline {
|
||||
agent any;
|
||||
|
||||
parameters {
|
||||
buildSelector(
|
||||
defaultSelector: lastSuccessful(),
|
||||
description: 'Which build to use for copying data artifacts',
|
||||
name: 'BUILD_SELECTOR_DATASET'
|
||||
)
|
||||
|
||||
buildSelector(
|
||||
defaultSelector: lastSuccessful(),
|
||||
description: 'Which build to use for copying training artifacts',
|
||||
name: 'BUILD_SELECTOR_TRAINING'
|
||||
)
|
||||
}
|
||||
|
||||
stages {
|
||||
|
||||
stage('copy-artifacts')
|
||||
{
|
||||
steps
|
||||
{
|
||||
copyArtifacts(fingerprintArtifacts: true, projectName: 's434742-create-dataset', selector: buildParameter('BUILD_SELECTOR_DATASET'))
|
||||
copyArtifacts(fingerprintArtifacts: true, projectName: 's434742-training/${BRANCH}', selector: buildParameter('BUILD_SELECTOR_TRAINING'))
|
||||
}
|
||||
}
|
||||
|
||||
stage('evaluation') {
|
||||
steps {
|
||||
script {
|
||||
def image = docker.build('dock')
|
||||
image.inside{
|
||||
sh 'chmod +x evaluation.py'
|
||||
sh 'python3 evaluation.py'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
26
evaluation.py
Normal file
26
evaluation.py
Normal file
@ -0,0 +1,26 @@
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
from tensorflow import keras
|
||||
import matplotlib.pyplot as plt
|
||||
from keras import backend as K
|
||||
from sklearn.metrics import mean_squared_error
|
||||
|
||||
model = 'suicide_model.h5'
|
||||
model = keras.models.load_model(model)
|
||||
|
||||
train = pd.read_csv('train.csv')
|
||||
test = pd.read_csv('test.csv')
|
||||
validate = pd.read_csv('validate.csv')
|
||||
|
||||
# podział train set
|
||||
X_train = train.loc[:, train.columns != 'suicides_no']
|
||||
y_train = train[['suicides_no']]
|
||||
X_test = test.loc[:, train.columns != 'suicides_no']
|
||||
y_test = test[['suicides_no']]
|
||||
|
||||
predictions = model.predict(X_test)
|
||||
|
||||
error = mean_squared_error(y_test, predictions)
|
||||
|
||||
with open('eval_results.txt', 'a') as f:
|
||||
f.write(str(error) + "\n")
|
Loading…
Reference in New Issue
Block a user