ium_434704/evaluation.py
Wojciech Jarmosz f1083d4e7a
Some checks failed
s434704-training/pipeline/head There was a failure building this commit
Add evaluation
2021-05-14 04:01:11 +02:00

29 lines
832 B
Python

import sys
import pandas as pd
import numpy as np
import tensorflow as tf
import os.path
from tensorflow import keras
from tensorflow.keras import layers
from tensorflow.keras.layers.experimental import preprocessing
# Wczytanie danych
test_data = pd.read_csv("./MoviesOnStreamingPlatforms_updated.test")
columns_to_use = ['Year', 'Runtime', 'Netflix']
test_X = tf.convert_to_tensor(test_data[columns_to_use])
test_Y = tf.convert_to_tensor(test_data[["IMDb"]])
model = tf.keras.models.load_model('linear_regression.h5')
scores = model.evaluate(x=test_X,
y=test_Y)
with open('single_metrics.txt', 'w') as file:
for idx, score in enumerate(scores):
if idx == 0:
file.write("Recall: " + str(score) + "\n")
if idx == 1:
file.write("RMSE: " + str(score) + "\n")