rulematrix/rule-matrix-py

IndexError running the example code

aydemirfb opened this issue · 2 comments

Hi,
I get the following error when I try to run the example. Any insights?

IndexError Traceback (most recent call last)

in ()
15 surrogate = train_surrogate(nn, 4, seed=44)
16 rl = surrogate.student
---> 17 print(rl)

/usr/local/lib/python3.6/dist-packages/pysbrl/rule_list.py in str(self)
355
356 def str(self):
--> 357 return self._print(self.feature_names, self.category_names, rt_str=True)

/usr/local/lib/python3.6/dist-packages/pysbrl/rule_list.py in _print(self, feature_names, category_names, rt_str)
346 is_last = rule.is_default()
347 categories = None if category_names is None else category_names[i]
--> 348 s += print_rule(rule, feature_names, categories, label="prob") + "\n"
349 if len(self._rule_list) > 1 and not is_last:
350 s += "\nELSE "

/usr/local/lib/python3.6/dist-packages/pysbrl/rule_list.py in print_rule(rule, feature_names, category_names, label, support)
85 _category_names = None
86 else:
---> 87 _category_names = category_names[feature_idx]
88 if _category_names is None:
89 categories.append(" = " + str(category))

IndexError: list index out of range

Hi @aydemirfb. It seems to be a dependency issue. Installing the latest pysbrl package should solve this problem:

pip install pysbrl==0.4.2rc0

The dependency on pysbrl has already updated to 0.4.2