2024-04-16 18:58:43 +02:00
|
|
|
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']]
|
2024-05-28 18:36:32 +02:00
|
|
|
y_test = test_data['review_overall']
|
2024-04-16 18:58:43 +02:00
|
|
|
|
|
|
|
model = tf.keras.models.load_model('beer_review_sentiment_model.h5')
|
|
|
|
|
2024-05-28 18:36:32 +02:00
|
|
|
predictions = model.predict(X_test)
|
2024-04-16 18:58:43 +02:00
|
|
|
|
2024-05-28 18:36:32 +02:00
|
|
|
print(f'Predictions shape: {predictions.shape}')
|
2024-04-16 18:58:43 +02:00
|
|
|
|
2024-05-28 18:36:32 +02:00
|
|
|
if len(predictions.shape) > 1:
|
|
|
|
predictions = predictions[:, 0]
|
2024-04-16 18:58:43 +02:00
|
|
|
|
2024-05-28 18:36:32 +02:00
|
|
|
results = pd.DataFrame({'Predictions': predictions, 'Actual': y_test})
|
|
|
|
results.to_csv('beer_review_sentiment_predictions.csv', index=False)
|