add plot
All checks were successful
s464980-evaluation/pipeline/head This commit looks good

This commit is contained in:
Sheaza 2024-05-14 22:41:29 +02:00
parent 7e36de3d17
commit 574f34d3b1
3 changed files with 18 additions and 4 deletions

View File

@ -17,7 +17,7 @@ pipeline {
steps { steps {
copyArtifacts fingerprintArtifacts: true, projectName: 'z-s464980-create-dataset', selector: buildParameter('BUILD_SELECTOR') copyArtifacts fingerprintArtifacts: true, projectName: 'z-s464980-create-dataset', selector: buildParameter('BUILD_SELECTOR')
copyArtifacts fingerprintArtifacts: true, projectName: 's464980-training/master', selector: buildParameter('BUILD_SELECTOR') copyArtifacts fingerprintArtifacts: true, projectName: 's464980-training/master', selector: buildParameter('BUILD_SELECTOR')
copyArtifacts fingerprintArtifacts: true, projectName: 's464980-evaluation/master', selector: buildParameter('BUILD_SELECTOR'), optional: true // copyArtifacts fingerprintArtifacts: true, projectName: 's464980-evaluation/master', selector: buildParameter('BUILD_SELECTOR'), optional: true
} }
} }
stage("Prediction") { stage("Prediction") {
@ -31,7 +31,7 @@ pipeline {
steps { steps {
sh "chmod +x ./predict.py" sh "chmod +x ./predict.py"
sh "python ./predict.py" sh "python ./predict.py"
archiveArtifacts artifacts: 'predictions.txt,accuracy.txt', onlyIfSuccessful: true archiveArtifacts artifacts: 'predictions.txt,accuracy.txt,rmse.jpg', onlyIfSuccessful: true
} }
} }
} }

View File

@ -2,6 +2,8 @@ import pandas as pd
from tensorflow import keras from tensorflow import keras
import numpy as np import numpy as np
from sklearn.metrics import root_mean_squared_error from sklearn.metrics import root_mean_squared_error
import matplotlib.pyplot as plt
np.set_printoptions(threshold=np.inf) np.set_printoptions(threshold=np.inf)
data = pd.read_csv("df_test.csv") data = pd.read_csv("df_test.csv")
@ -17,4 +19,15 @@ with open("predictions.txt", "w") as f:
accuracy = root_mean_squared_error(y_test, predictions) accuracy = root_mean_squared_error(y_test, predictions)
with open("rmse.txt", 'a') as file: with open("rmse.txt", 'a') as file:
file.write(str(accuracy)) file.write(str(accuracy)+"\n")
with open("rmse.txt", 'r') as file:
lines = file.readlines()
num_lines = len(lines)
lines = [float(line.replace("\n", "")) for line in lines]
plt.plot(range(1, num_lines+1), lines)
plt.xlabel("Build number")
plt.ylabel("RMSE value")
plt.title("RMSE")
plt.savefig("rmse.jpg")

View File

@ -2,3 +2,4 @@ pandas
scikit-learn scikit-learn
tensorflow tensorflow
numpy numpy
matplotlib