Skip to content

Commit

Permalink
Make sure its defined
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Li <adam2392@gmail.com>
  • Loading branch information
adam2392 committed Jul 11, 2024
1 parent 05f2f9f commit ae2604b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sklearn/tree/_splitter.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,13 @@ cdef inline int node_split_random(
current_split.threshold
)

if missing_go_to_left:
n_left = current_split.pos - start + n_missing
n_right = end_non_missing - current_split.pos
else:
n_left = current_split.pos - start
n_right = end_non_missing - current_split.pos + n_missing

# Reject if min_samples_leaf is not guaranteed
if splitter.check_presplit_conditions(&current_split, n_missing, missing_go_to_left) == 1:
continue
Expand Down

0 comments on commit ae2604b

Please sign in to comment.