Open
Description
Calling explainer.minimal_contrastive_reason(time_limit=5)
raises this error:
File ~/Logiciels/pyxai/pyxai/sources/core/explainer/explainerBT.py:363, in ExplainerBT.minimal_contrastive_reason(self, n, time_limit)
361 starting_time = -time.process_time()
362 contrastive_bt = ContrastiveBT()
--> 363 c = contrastive_bt.create_model_and_solve(self, None if self._theory is False else self._theory_clauses(), self._excluded_literals, n, time_limit)
364 time_used = starting_time + time.process_time()
365 self._elapsed_time = time_used if time_limit is None or time_used < time_limit else Explainer.TIMEOUT
File ~/Logiciels/pyxai/pyxai/sources/solvers/MIP/ContrastiveBT.py:28, in ContrastiveBT.create_model_and_solve(self, explainer, theory, excluded, n, time_limit)
25 flipped = [solver.BoolVar(f"z[{i}]") for i in range(bin_len)] # The flipped variables
27 # Constraints related to tree structure
---> 28 tree_structure_constraints(explainer, solver, active_leaves, instance)
30 # Constraints related to theory
31 theory_constraints(solver, instance, theory)
File ~/Logiciels/pyxai/pyxai/sources/solvers/MIP/help_functions.py:19, in tree_structure_constraints(explainer, solver, active_leaves, instance)
17 for j, tree in enumerate(forest):
18 for i, leave in enumerate(tree.get_leaves()):
---> 19 t = TypeLeaf.LEFT if leave.parent.left == leave else TypeLeaf.RIGHT
20 cube = forest[j].create_cube(leave.parent, t)
21 nb_neg = sum((1 for l in cube if l < 0))
AttributeError: 'NoneType' object has no attribute 'left'
Metadata
Metadata
Assignees
Labels
No labels