First evaluation test

This commit is contained in:
Dominik Strzako 2021-05-15 15:33:42 +02:00
parent 31d173ca47
commit 5e28406d7c
4 changed files with 67 additions and 8 deletions

View File

@ -1,7 +1,5 @@
pipeline {
agent {
dockerfile true
}
agent {docker { image 'snowycocoon/ium_434788:3'}}
//Definijuemy parametry, które będzie można podać podczas wywoływania zadania
parameters {
string (

View File

@ -1,6 +1,6 @@
pipeline {
agent {
docker { image 'snowycocoon/ium_434788:2' }
docker { image 'snowycocoon/ium_434788:3' }
}
stages {
stage('Test') {

View File

@ -1,10 +1,20 @@
pipeline {
agent {docker { image 'adnovac/ium_s434760:1.0' }}
agent {docker { image 'snowycocoon/ium_434788:3'}}
parameters{
buildSelector(
defaultSelector: lastSuccessful(),
description: 'Which build to use for copying data artifacts',
name: 'WHICH_BUILD_DATA'
)
buildSelector(
defaultSelector: lastSuccessful(),
description: 'Which build to use for copying artifacts',
name: 'WHICH_BUILD'
description: 'Which build to use for copying train artifacts',
name: 'WHICH_BUILD_TRAIN'
)
buildSelector(
defaultSelector: lastSuccessful(),
description: 'Which build to use for copying current project artifacts',
name: 'WHICH_BUILD_THIS'
)
}
@ -14,6 +24,22 @@ pipeline {
steps
{
copyArtifacts(fingerprintArtifacts: true, projectName: 's434788-create-dataset', selector: buildParameter('WHICH_BUILD'))
copyArtifacts(fingerprintArtifacts: true, projectName: 's434788-training/master', selector: buildParameter('WHICH_BUILD_TRAIN'))
copyArtifacts(fingerprintArtifacts: true, optional: true, projectName: 's434788-evaluation/master', selector: buildParameter('WHICH_BUILD_THIS'))
}
}
stage('evaluate')
{
steps
{
catchError {
sh 'python3.8 Zadanie_06_evaluate.py'
}
}
}
stage('archive artifacts') {
steps {
archiveArtifacts 'results.txt,evaluation.png'
}
}
}

View File

@ -1 +1,36 @@
print('evaluating')
import pandas as pd
import numpy as np
from os import path
from tensorflow import keras
import sys
import matplotlib.pyplot as plt
from sklearn.metrics import accuracy_score, classification_report
model = keras.models.load_model('saved_model.pb')
print('evaluating')
test_df =pd.read_csv('test.csv')
y_test = test_df.quality
x_test = test_df.drop(['quality'], axis= 1)
y_pred = model.predict(x_test)
y_pred = np.around(y_pred, decimals=0)
results = accuracy_score(y_test,y_pred)
with open('results.txt', 'a+', encoding="UTF-8") as f:
f.write(str(results) +"\n")
with open('results.txt', 'r', encoding="UTF-8") as f:
lines = f.readlines()
fig = plt.figure(figsize=(10,10))
chart = fig.add_subplot()
chart.set_ylabel("Accuracy")
chart.set_xlabel("Number of build")
x = np.arange(0, len(lines), 1)
y = [float(x) for x in lines]
print(y)
plt.plot(x,y,"ro")
plt.savefig("evaluation.png")