19 lines
475 B
Python
19 lines
475 B
Python
from sklearn.metrics import confusion_matrix
|
|
import pandas as pd
|
|
import sys
|
|
|
|
|
|
def main():
|
|
y_test = pd.read_csv("beer_reviews_test.csv")
|
|
y_pred = pd.read_csv("beer_review_sentiment_predictions.csv", header=None)
|
|
build_number = sys.argv[1]
|
|
|
|
cm = confusion_matrix(y_test, y_pred)
|
|
accuracy = cm[1, 1] / (cm[1, 0] + cm[1, 1])
|
|
|
|
with open(r"beer_metrics.txt", "a") as f:
|
|
f.write(f"{accuracy},{build_number}\n")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main() |