2024-04-03 09:39:37 +02:00
|
|
|
import pandas as pd
|
|
|
|
from tensorflow import keras
|
|
|
|
import numpy as np
|
2024-05-14 22:23:41 +02:00
|
|
|
from sklearn.metrics import root_mean_squared_error
|
2024-05-14 22:41:29 +02:00
|
|
|
import matplotlib.pyplot as plt
|
|
|
|
|
2024-04-03 09:39:37 +02:00
|
|
|
np.set_printoptions(threshold=np.inf)
|
|
|
|
|
|
|
|
data = pd.read_csv("df_test.csv")
|
|
|
|
X_test = data.drop("Performance Index", axis=1)
|
|
|
|
y_test = data["Performance Index"]
|
|
|
|
|
|
|
|
model = keras.models.load_model("model.keras")
|
|
|
|
|
|
|
|
predictions = model.predict(X_test)
|
|
|
|
|
|
|
|
with open("predictions.txt", "w") as f:
|
|
|
|
f.write(str(predictions))
|
2024-05-14 22:17:35 +02:00
|
|
|
|
2024-05-14 23:09:01 +02:00
|
|
|
rmse = root_mean_squared_error(y_test, predictions)
|
2024-05-14 22:24:34 +02:00
|
|
|
with open("rmse.txt", 'a') as file:
|
2024-05-14 23:09:01 +02:00
|
|
|
file.write(str(rmse)+"\n")
|
2024-05-14 22:41:29 +02:00
|
|
|
|
|
|
|
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")
|