Skip to content

Commit ccccf9c

Browse files
authored
FIX revert cython changes (#351)
* FIX implement additional fix for pruning * STY cython-lint honesty pyx * DOC update version number * FIX revert cython changes * STY cython-lint honesty file
1 parent 7afb17e commit ccccf9c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

treeple/tree/honesty/_honest_prune.pyx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ cdef class HonestPruner(Splitter):
153153

154154
n_missing += 1
155155
current_end -= 1
156+
157+
# Leverage sklearn's forked API to compute the feature value at this split node
158+
# and then compare that to the corresponding threshold
159+
# Note: this enables the function to work w/ both axis-aligned and oblique splits.
156160
elif p > pos and (self.tree._compute_feature(X_ndarray, sample_idx, &self.tree.nodes[node_idx])<= threshold):
157161
self.samples[p], self.samples[pos] = \
158162
self.samples[pos], self.samples[p]
@@ -368,9 +372,8 @@ cdef _honest_prune(
368372
split_is_degenerate = (
369373
pruner.n_left_samples() == 0 or pruner.n_right_samples() == 0
370374
)
371-
# is_leaf_in_origtree = child_l[node_idx] == _TREE_LEAF
372-
# consider whether left or right children node is a leaf node.
373-
is_leaf_in_origtree = (child_l[node_idx] == _TREE_LEAF and child_r[node_idx] == _TREE_LEAF)
375+
376+
is_leaf_in_origtree = child_l[node_idx] == _TREE_LEAF
374377

375378
if invalid_split or split_is_degenerate or is_leaf_in_origtree:
376379
# invalid_split or is_leaf_in_origtree:

0 commit comments

Comments
 (0)