-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_benchmark_synthetic.py
More file actions
59 lines (45 loc) · 1.72 KB
/
run_benchmark_synthetic.py
File metadata and controls
59 lines (45 loc) · 1.72 KB
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
57
58
59
"""Synthetic benchmark command dispatcher.
This wrapper preserves the historical top-level entrypoint while the actual
implementation lives under ``src/scshapebench/synthetic``.
Available commands:
- ``generate``: batch-generate a synthetic benchmark dataset
- ``evaluate``: evaluate benchmark outputs
- ``run-methods``: run the method benchmark on a dataset
- ``run-swept-methods``: run the swept-dataset convenience wrapper
If no command is provided, ``run-swept-methods`` is used.
"""
from __future__ import annotations
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parent
SRC = ROOT / "src"
if str(SRC) not in sys.path:
sys.path.insert(0, str(SRC))
def _dispatch(command: str, argv: list[str]) -> None:
if command == "generate":
from scshapebench.synthetic.batch_generate_benchmark import main
elif command == "evaluate":
from scshapebench.synthetic.evaluation import main
elif command == "run-methods":
from scshapebench.synthetic.method_benchmark.run_methods import main
elif command == "run-swept-methods":
from scshapebench.synthetic.method_benchmark.run_methods_on_swept_dataset import main
else:
raise SystemExit(
f"Unknown synthetic command: {command!r}. "
"Use one of: generate, evaluate, run-methods, run-swept-methods."
)
sys.argv = [sys.argv[0], *argv]
main()
def main() -> None:
args = sys.argv[1:]
commands = {"generate", "evaluate", "run-methods", "run-swept-methods"}
if args and args[0] in commands:
command = args[0]
argv = args[1:]
else:
command = "run-swept-methods"
argv = args
_dispatch(command, argv)
if __name__ == "__main__":
main()