Skip to content

Commit 93b605f

Browse files
authored
Merge pull request #23 from zhi-bao/prune_inference
Fix the bug in pruning tree predictions.
2 parents 8756b64 + 48a6aec commit 93b605f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libmultilabel/linear/tree.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def _separate_model_for_pruning_tree(self):
101101
self.subtree_models = []
102102
for i in range(len(self.root.children)):
103103
subtree_weights_start = self.node_ptr[self.root.children[i].index]
104-
subtree_weights_end = self.node_ptr[self.root.children[i+1].index] if i+1 < len(self.root.children) else -1
104+
subtree_weights_end = self.node_ptr[self.root.children[i+1].index] if i+1 < len(self.root.children) else self.node_ptr[-1]
105105
slice = np.s_[:, subtree_weights_start:subtree_weights_end]
106106
subtree_flatmodel = linear.FlatModel(
107107
name="subtree-flattened-tree",

0 commit comments

Comments
 (0)