Skip to content

Commit ae2604b

Browse files
committed
Make sure its defined
Signed-off-by: Adam Li <adam2392@gmail.com>
1 parent 05f2f9f commit ae2604b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

sklearn/tree/_splitter.pyx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,13 @@ cdef inline int node_split_random(
959959
current_split.threshold
960960
)
961961

962+
if missing_go_to_left:
963+
n_left = current_split.pos - start + n_missing
964+
n_right = end_non_missing - current_split.pos
965+
else:
966+
n_left = current_split.pos - start
967+
n_right = end_non_missing - current_split.pos + n_missing
968+
962969
# Reject if min_samples_leaf is not guaranteed
963970
if splitter.check_presplit_conditions(&current_split, n_missing, missing_go_to_left) == 1:
964971
continue

0 commit comments

Comments
 (0)