-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaccuracy_score.py
35 lines (25 loc) · 1008 Bytes
/
accuracy_score.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import pandas as pd
from sklearn.metrics import accuracy_score
import argparse
def calculate_accuracy(true_labels_csv, predicted_labels_csv):
true_labels = pd.read_csv(true_labels_csv)
predicted_labels = pd.read_csv(predicted_labels_csv)
true_labels = true_labels.sort_values(by="Index")
predicted_labels = predicted_labels.sort_values(by="Index")
accuracy = accuracy_score(
true_labels["Hogwarts House"], predicted_labels["Hogwarts House"]
)
return accuracy
def main():
parser = argparse.ArgumentParser(
description="Calculate accuracy score between two CSV files."
)
parser.add_argument("true_labels", type=str, help="CSV file with true labels.")
parser.add_argument(
"predicted_labels", type=str, help="CSV file with predicted labels."
)
args = parser.parse_args()
accuracy = calculate_accuracy(args.true_labels, args.predicted_labels)
print(f"Accuracy Score: {accuracy}")
if __name__ == "__main__":
main()