summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBirte Kristina Friesel <birte.friesel@uos.de>2024-01-11 15:54:03 +0100
committerBirte Kristina Friesel <birte.friesel@uos.de>2024-01-11 15:54:03 +0100
commitbf79195b5bb6e5cb3688823b595006b169d92730 (patch)
tree623962e54cf3b017afdf766f236e0f571495e18e
parent9705d6687def65a82193e60aa69137ab5bd1d047 (diff)
Rename --show-quality=table to --show-model-error
-rwxr-xr-xbin/analyze-archive.py7
-rwxr-xr-xbin/analyze-kconfig.py28
-rwxr-xr-xbin/analyze-log.py9
-rw-r--r--doc/energy-kratos.md2
-rw-r--r--doc/energy-multipass.md2
-rw-r--r--doc/model-assessment.md4
-rw-r--r--lib/cli.py5
7 files changed, 14 insertions, 43 deletions
diff --git a/bin/analyze-archive.py b/bin/analyze-archive.py
index 2f5e680..4b9b7b4 100755
--- a/bin/analyze-archive.py
+++ b/bin/analyze-archive.py
@@ -200,11 +200,10 @@ if __name__ == "__main__":
)
parser.add_argument(
"--show-quality",
- choices=["table", "summary"],
+ choices=["overall", "summary"],
action="append",
default=list(),
- help="table: show LUT, model, and static prediction error for each state/transition and attribute.\n"
- "summary: show static/fitted/lut SMAPE and MAE for each attribute, averaged over all states/transitions.",
+ help="summary: show static/fitted/lut SMAPE and MAE for each attribute, averaged over all states/transitions.",
)
parser.add_argument(
"--ignored-trace-indexes",
@@ -723,7 +722,7 @@ if __name__ == "__main__":
analytic_quality = model.assess(param_model)
xv_analytic_models = None
- if "table" in show_quality or "all" in show_quality:
+ if args.show_model_error:
dfatool.cli.model_quality_table(
lut=lut_quality,
model=analytic_quality,
diff --git a/bin/analyze-kconfig.py b/bin/analyze-kconfig.py
index bc47242..4cf03b5 100755
--- a/bin/analyze-kconfig.py
+++ b/bin/analyze-kconfig.py
@@ -143,13 +143,6 @@ def main():
help="Restrict model generation to N random samples",
metavar="N",
)
- parser.add_argument(
- "--show-quality",
- choices=["table"],
- action="append",
- default=list(),
- help="table: show LUT, model, and static prediction error for each key and attribute.",
- )
parser.add_argument("kconfig_path", type=str, help="Path to Kconfig file")
parser.add_argument(
"model",
@@ -525,7 +518,7 @@ def main():
f"{name:20s} {attribute:15s}", info, model.parameters
)
- if "table" in args.show_quality or "all" in args.show_quality:
+ if args.show_model_error:
dfatool.cli.model_quality_table(
lut=lut_quality,
model=analytic_quality,
@@ -536,25 +529,6 @@ def main():
error_metric=args.error_metric,
)
- if not args.show_quality:
- if xv_method is not None:
- print(f"Model Error after Cross Validation ({xv_method}, {xv_count}):")
- else:
- print("Model Error on Training Data:")
- for name in sorted(model.names):
- for attribute, error in sorted(
- analytic_quality[name].items(), key=lambda kv: kv[0]
- ):
- mae = error["mae"]
- mape = error["mape"]
- smape = error["smape"]
- if mape is not None:
- print(f"{name:15s} {attribute:20s} ± {mae:10.2} / {mape:5.1f}%")
- else:
- print(
- f"{name:15s} {attribute:20s} ± {mae:10.2} / {smape:5.1f}% SMAPE"
- )
-
if args.show_model_size:
dfatool.cli.print_model_size(model)
diff --git a/bin/analyze-log.py b/bin/analyze-log.py
index be11f5d..e8f3a84 100755
--- a/bin/analyze-log.py
+++ b/bin/analyze-log.py
@@ -37,13 +37,6 @@ def main():
)
dfatool.cli.add_standard_arguments(parser)
parser.add_argument(
- "--show-quality",
- choices=["table"],
- action="append",
- default=list(),
- help="table: show LUT, model, and static prediction error for each key and attribute.",
- )
- parser.add_argument(
"--force-tree",
action="store_true",
help="Build decision tree without checking for analytic functions first",
@@ -222,7 +215,7 @@ def main():
f"{name:10s} {attribute:15s}", info, model.parameters
)
- if "table" in args.show_quality or "all" in args.show_quality:
+ if args.show_model_error:
dfatool.cli.model_quality_table(
lut=lut_quality,
model=analytic_quality,
diff --git a/doc/energy-kratos.md b/doc/energy-kratos.md
index 03ac3de..3d47a1c 100644
--- a/doc/energy-kratos.md
+++ b/doc/energy-kratos.md
@@ -45,5 +45,5 @@ analysiert werden:
```
cd dfatool
-bin/analyze-archive.py --info --show-model=all --show-quality=table ../data/...-radio.tar
+bin/analyze-archive.py --info --show-model=all --show-model-error ../data/...-radio.tar
```
diff --git a/doc/energy-multipass.md b/doc/energy-multipass.md
index bc49175..ce273aa 100644
--- a/doc/energy-multipass.md
+++ b/doc/energy-multipass.md
@@ -76,7 +76,7 @@ analysiert werden:
```
cd dfatool
-bin/analyze-archive.py --info --show-model=all --show-quality=table ../data/...-sharp96.tar
+bin/analyze-archive.py --info --show-model=all --show-model-error ../data/...-sharp96.tar
```
Sofern sich die LED-Leistungsaufnahme des verwendeten Launchpads im üblichen
diff --git a/doc/model-assessment.md b/doc/model-assessment.md
index f468f42..a5ecd2f 100644
--- a/doc/model-assessment.md
+++ b/doc/model-assessment.md
@@ -2,13 +2,13 @@
## Tabular Comparison
-`--show-quality=table` outputs a table that shows LUT error, model error, and
+`--show-model-error` outputs a table that shows LUT error, model error, and
static error. In general, the model is suitable if its prediction error is
close to LUT error and far away from static error.
The error metric can be selected via `--error-metric`.
-It is generally a good idea to combine `--show-quality=table` with
+It is generally a good idea to combine `--show-model-error` with
`--cross-validate=kfold:10` and, depending on application,
`--parameter-aware-cross-validation`. Note that LUT error serves as baseline
("lowest achievable prediction error" / underlying measurement uncertainty)
diff --git a/lib/cli.py b/lib/cli.py
index 25ad260..86e9bc8 100644
--- a/lib/cli.py
+++ b/lib/cli.py
@@ -478,6 +478,11 @@ def add_standard_arguments(parser):
"all: all of the above",
)
parser.add_argument(
+ "--show-model-error",
+ action="store_true",
+ help="Show model error compared to LUT (lower bound) and static (reference) models",
+ )
+ parser.add_argument(
"--show-model-size",
action="store_true",
help="Show model size (e.g. regression tree height and node count)",