summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/analyze-log.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/bin/analyze-log.py b/bin/analyze-log.py
index 444ecd2..2846d7c 100755
--- a/bin/analyze-log.py
+++ b/bin/analyze-log.py
@@ -12,6 +12,7 @@ import dfatool.utils
from dfatool.model import AnalyticModel
from dfatool.validation import CrossValidator
from functools import reduce
+import json
import re
@@ -106,6 +107,9 @@ def main():
help="Build decision tree without checking for analytic functions first",
)
parser.add_argument(
+ "--export-model", metavar="FILE", type=str, help="Export JSON model to FILE"
+ )
+ parser.add_argument(
"logfiles", nargs="+", type=str, help="Path to benchmark output"
)
args = parser.parse_args()
@@ -209,6 +213,14 @@ def main():
[None, param_info, None],
)
+ if args.export_model:
+ print(f"Exportding model to {args.export_model}")
+ json_model = model.to_json()
+ with open(args.export_model, "w") as f:
+ json.dump(
+ json_model, f, indent=2, sort_keys=True, cls=dfatool.utils.NpEncoder
+ )
+
if args.plot_param:
for kv in args.plot_param.split(";"):
try: