IUM_06
This commit is contained in:
parent
09d4b0772f
commit
845249c6c5
@ -1,6 +1,7 @@
|
||||
import pandas as pd
|
||||
from sklearn.metrics import accuracy_score, precision_recall_fscore_support, mean_squared_error
|
||||
from math import sqrt
|
||||
import sys
|
||||
|
||||
# Load the predictions data
|
||||
data = pd.read_csv('beer_review_sentiment_predictions.csv')
|
||||
@ -8,6 +9,8 @@ y_pred = data['Predictions']
|
||||
y_test = data['Actual']
|
||||
y_test_binary = (y_test >= 3).astype(int)
|
||||
|
||||
build_number = sys.argv[1]
|
||||
|
||||
# Calculate metrics
|
||||
accuracy = accuracy_score(y_test_binary, y_pred.round())
|
||||
precision, recall, f1, _ = precision_recall_fscore_support(y_test_binary, y_pred.round(), average='micro')
|
||||
@ -17,4 +20,7 @@ print(f'Accuracy: {accuracy}')
|
||||
print(f'Micro-avg Precision: {precision}')
|
||||
print(f'Micro-avg Recall: {recall}')
|
||||
print(f'F1 Score: {f1}')
|
||||
print(f'RMSE: {rmse}')
|
||||
print(f'RMSE: {rmse}')
|
||||
|
||||
with open(r"beer_metrics.txt", "a") as f:
|
||||
f.write(f"{accuracy},{build_number}\n")
|
Loading…
Reference in New Issue
Block a user