ium_464979/IUM_05-predict.py
AWieczarek e9f53be954 IUM_10
2024-05-28 18:36:32 +02:00

18 lines
589 B
Python

import pandas as pd
import tensorflow as tf
test_data = pd.read_csv('./beer_reviews_test.csv')
X_test = test_data[['review_aroma', 'review_appearance', 'review_palate', 'review_taste']]
y_test = test_data['review_overall']
model = tf.keras.models.load_model('beer_review_sentiment_model.h5')
predictions = model.predict(X_test)
print(f'Predictions shape: {predictions.shape}')
if len(predictions.shape) > 1:
predictions = predictions[:, 0]
results = pd.DataFrame({'Predictions': predictions, 'Actual': y_test})
results.to_csv('beer_review_sentiment_predictions.csv', index=False)