From 31a6f42e08a0285b2f6153a91605a400089d1199 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 16 Sep 2020 15:52:03 +0200 Subject: make choice node configurable --- lib/model.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'lib/model.py') diff --git a/lib/model.py b/lib/model.py index f422204..a75033c 100644 --- a/lib/model.py +++ b/lib/model.py @@ -1317,6 +1317,7 @@ class KConfigModel: self.choices = kconfig_benchmark.choice_names self.symbol = kconfig_benchmark.symbol self.choice = kconfig_benchmark.choice + self.with_choice_node = True self.max_loss = 10 if callable(attribute): self.attribute = "custom" @@ -1356,9 +1357,6 @@ class KConfigModel: return np.sum((model_value - values) ** 2, dtype=np.float64) def build_tree(self): - # without ChoiceNode: - # self.model = self._build_tree(self.symbols, list(), self.data, 0) - standalone_symbols = list( filter( lambda sym: self.symbol[sym].choice is None @@ -1369,7 +1367,12 @@ class KConfigModel: tree_choices = list( filter(lambda choice: not self.choice[choice].is_optional, self.choices) ) - self.model = self._build_tree(standalone_symbols, tree_choices, self.data, 0) + if self.with_choice_node: + self.model = self._build_tree( + standalone_symbols, tree_choices, self.data, 0 + ) + else: + self.model = self._build_tree(self.symbols, list(), self.data, 0) def value_for_config(self, kconf): return self.model.model(kconf) -- cgit v1.2.3