-
Notifications
You must be signed in to change notification settings - Fork 0
/
evaluate.py
39 lines (32 loc) · 1.07 KB
/
evaluate.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
import argparse
import json
from typing import List, Dict
from lib.tree_node import TreeNode
from lib.utils import read_jsonl, get_percentage_error_list
from lib.end2end import evaluate_predictions_from_filepaths
def main():
parser = argparse.ArgumentParser("Evaluates predictions and prints results")
parser.add_argument(
"ground_truth_filepath",
type=str,
help="path to trees containing ground_truths (jsonl format).",
)
parser.add_argument(
"prediction_filepath",
type=str,
help="path to trees containing predictions (jsonl format).",
)
parser.add_argument(
"--node_types",
type=str,
default="ml,module,model",
help="comma seperated node_types. node_types are ml, module, model.",
)
args = parser.parse_args()
results = evaluate_predictions_from_filepaths(
args.ground_truth_filepath, args.prediction_filepath, args.node_types.split(",")
)
print("Percentage Error Results:")
print(json.dumps(results, indent=4))
if __name__ == "__main__":
main()