-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_csv.py
47 lines (36 loc) · 1.74 KB
/
test_csv.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
36
37
38
39
40
41
42
43
44
45
46
47
import argparse
from timeit import default_timer as timer
from evaluator.evaluator import Evaluator
import datetime
# TODO Find solution for PosixPath and WindowsPath
# when model is trained on Linux, it expects a PosixPath to load on Windows as well and vice versa
# import pathlib
# temp = pathlib.PosixPath
# pathlib.PosixPath = pathlib.WindowsPath
# TODO Assume that ground truth df and pred df are in the exact same label space
def main(config):
evaluator = Evaluator()
start = timer()
evaluator.evaluate_csv(config)
end = timer()
prediction_time = datetime.timedelta(seconds=(end - start))
evaluator.pred_time = prediction_time
evaluator.load_validation_eval_df(save_path=config["out_path"])
evaluator.save(type_eval="test")
if __name__ == '__main__':
args = argparse.ArgumentParser(description='Script to evaluate model predictions by comparing with the '
'ground truths. Both predicitons and ground truths are normalized to '
'match the EASIER label format.')
args.add_argument('-p', '--model_preds', default=None, type=str,
help="path to csv file with emotion predictions")
args.add_argument('-t', '--ground_truths', default=None, type=str,
help="path to csv file with emotion ground truths")
args.add_argument('-o', '--out_csv_file', default=None, type=str,
help="path to csv file to save the evaluation csv results")
args = args.parse_args()
config = {
"model_preds": args.model_preds,
"ground_truths": args.ground_truths,
"out_path": args.out_csv_file
}
main(config)