-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathrun.py
56 lines (47 loc) · 1.46 KB
/
run.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
48
49
50
51
52
53
54
55
56
from argparse import ArgumentParser
from pathlib import Path
from sys import exit
from constants import DATA_PATH
from experiments import run_vignettes_experiment
from inference import create_marginals_files
from results import produce_results
from utils import ensure_dir, load_from_json
def parse_args():
parser = ArgumentParser(description="Counterfactual Diagnosis experimental code")
parser.add_argument(
"--datapath", type=Path, default=DATA_PATH, help="Path to data files"
)
parser.add_argument(
"--first", type=int, required=False, default=None, help="Run the first N cards"
)
parser.add_argument(
"--results",
type=Path,
default=Path("results"),
help="Output path for results files.",
)
parser.add_argument(
"-v",
"--verbose",
default=False,
action="store_true",
help="Run with verbose logging",
)
parser.add_argument(
"--reproduce",
default=False,
action="store_true",
help="Reproduce paper results",
)
return parser.parse_args()
if __name__ == "__main__":
args = parse_args()
ensure_dir(args.results)
if args.reproduce is False:
print(
f">>> Running over local model files in {args.datapath/'test_networks.json'}"
)
create_marginals_files(args=args)
run_vignettes_experiment(args=args)
if args.reproduce is True:
produce_results(args=args)