Open
Description
Hello !
I tried the TREPAN demo file available here
I wanted to see how the resulting tree would look like if the parameter m_of_n was set to true, but I received this error output :
Assuming continuous features in the absence of feature specifications
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Input In [23], in <module>
1 t0 = time.time()
----> 3 explanation.fit(x_train, model)
5 t1 = time.time()
7 print(f'Time taken to learn explanation: {t1-t0} seconds')
File ~\miniconda3\lib\site-packages\generalizedtrees\learn.py:111, in GreedyTreeLearner.fit(self, *args, **kwargs)
108 self.builder.initialize(self.givens)
110 # Build tree
--> 111 self.tree = self.builder.build_tree()
113 # Prune tree
114 self.tree = self.builder.prune_tree(self.tree)
File ~\miniconda3\lib\site-packages\generalizedtrees\grow.py:214, in GreedyBuilderLC.build_tree(self)
210 node, ptr = queue.pop()
212 if not self.local_stop.check(tree.node(ptr)):
--> 214 node.split = self.splitter.construct_split(node)
216 if node.split:
217 for child in self.node_builder.generate_children(node):
File ~\miniconda3\lib\site-packages\generalizedtrees\split.py:628, in MofNSplitConstructorLC.construct_split(self, node, data, y)
626 # Trick to iterate over a past snapshot of the beam while modifying the real thing
627 for scored_constraint in prev_beam:
--> 628 for new_constraint in MofN.neighboring_tests(scored_constraint.item, constraint_candidates):
629 if self.tests_sig_diff(scored_constraint.item, new_constraint, s_data, s_y):
630 new_score = self.split_scorer.score(node, BinarySplit(new_constraint), s_data, s_y)
File ~\miniconda3\lib\site-packages\generalizedtrees\constraints.py:220, in MofN.neighboring_tests(constraint, constraint_candidates, search_operators)
218 for atom in constraint_candidates:
219 new_atoms = constraint.constraints + (atom,)
--> 220 yield MofN(new_m, new_atoms)
222 elif operator & MofN.SearchOperator.DEC_N:
223 atoms = list(constraint.constraints)
File ~\miniconda3\lib\site-packages\generalizedtrees\constraints.py:138, in MofN.__init__(self, m, constraints)
136 if c1 == ~c2:
137 constraints_list.remove(c1)
--> 138 constraints_list.remove(c2)
139 m -= 1
141 # TODO: Check if any of the constraints subsume each other
ValueError: list.remove(x): x not in list
On this code :
t0 = time.time()
explanation.fit(x_train, model)
t1 = time.time()
print(f'Time taken to learn explanation: {t1-t0} seconds')
Do you know why it happened ?
EDIT : So I've tried launching it multiple times, after 5-10 tries, I finally achieved to obtain a tree (took ~45 min compared to the usual 2-3 seconds when the parameter is set to false. I knew it was a glutton algorithm, but I didn't expect to that point). Since the program is able to end, it would seem there may be a little problem in the algorithm for the m-of-n search process
Metadata
Metadata
Assignees
Labels
No labels