Skip to content

Commit fb67c7b

Browse files
authored
FIX Explicit int cast in NN binary trees (scikit-learn#18654)
1 parent 38a50f4 commit fb67c7b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sklearn/neighbors/_binary_tree.pxi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,8 @@ cdef class BinaryTree:
10741074
# determine number of levels in the tree, and from this
10751075
# the number of nodes in the tree. This results in leaf nodes
10761076
# with numbers of points between leaf_size and 2 * leaf_size
1077-
self.n_levels = np.log2(fmax(1, (n_samples - 1) / self.leaf_size)) + 1
1077+
self.n_levels = int(
1078+
np.log2(fmax(1, (n_samples - 1) / self.leaf_size)) + 1)
10781079
self.n_nodes = (2 ** self.n_levels) - 1
10791080

10801081
# allocate arrays for storage

0 commit comments

Comments
 (0)