summaryrefslogtreecommitdiff
path: root/bin/eval-kconfig.py
diff options
context:
space:
mode:
Diffstat (limited to 'bin/eval-kconfig.py')
-rwxr-xr-xbin/eval-kconfig.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/bin/eval-kconfig.py b/bin/eval-kconfig.py
index 1f44b9e..7f48b52 100755
--- a/bin/eval-kconfig.py
+++ b/bin/eval-kconfig.py
@@ -10,6 +10,8 @@ import logging
import os
import sys
+import numpy as np
+
from dfatool import kconfig, validation
from dfatool.loader import KConfigAttributes
from dfatool.model import KConfigModel
@@ -32,6 +34,9 @@ def main():
parser.add_argument(
"--attribute", choices=["rom", "ram"], default="rom", help="Model attribute"
)
+ parser.add_argument(
+ "--with-choice-node", action="store_true", help="Use non-binary Choice Nodes"
+ )
parser.add_argument("kconfig_path", type=str, help="Path to Kconfig file")
parser.add_argument(
"experiment_root", type=str, help="Experiment results directory"
@@ -53,14 +58,15 @@ def main():
measures = list()
for training_set, validation_set in partition_pairs:
model = KConfigModel.from_benchmark(data, args.attribute, indices=training_set)
+ model.with_choice_node = args.with_choice_node
model.build_tree()
measures.append(model.assess_benchmark(data, indices=validation_set))
aggregate = dict()
for measure in measures[0].keys():
- aggregate[measure] = np.mean(map(lambda m: m[measure], measures))
+ aggregate[measure] = np.mean(list(map(lambda m: m[measure], measures)))
aggregate["unpredictable_count"] = np.sum(
- map(lambda m: m["unpredictable_count"], measures)
+ list(map(lambda m: m["unpredictable_count"], measures))
)
print("10-fold Cross Validation:")