-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalc_accuracy.py
More file actions
24 lines (21 loc) · 863 Bytes
/
calc_accuracy.py
File metadata and controls
24 lines (21 loc) · 863 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import pandas as pd
import os
import argparse
def calc_accuracy(file_path):
read_path = os.path.join(file_path, "current_accuracy_AUC_PR.csv")
data = pd.read_csv(read_path)
columns_to_extract = data.iloc[:, [0, 3]]
result = columns_to_extract.groupby(columns_to_extract.columns[0])[columns_to_extract.columns[1]].mean().reset_index()
result.columns = ['Dataset', 'Accuracy']
output_path = os.path.join(file_path, "cal_accuracy.csv")
result.to_csv(output_path, index=False)
if __name__ == "__main__":
parser = argparse.ArgumentParser(
prog='calc_accuracy',
description='Script for calculating the accuracy of the training',
)
parser.add_argument('-p', '--path', type=str, help='path to the score to save', required=True)
args = parser.parse_args()
calc_accuracy(
file_path=args.path
)