diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2023-06-29 16:50:27 +0200 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2023-06-29 16:50:27 +0200 |
commit | 9b83049f6c8e5b7780125865b65b191a61d69701 (patch) | |
tree | 8d212af4eea18626c9e37fd513642345f74c86a1 /bin | |
parent | 1dd6a37b6d75cbee626f5e0365d65f376482a096 (diff) |
analyze-log: add --export-model suport
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/analyze-log.py | 12 |
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: |