Skip to content

Commit 2431ea3

Browse files
thomasjpfanadrinjalali
authored andcommitted
BUG Fixes cython code for ppc arch (scikit-learn#17201)
* BUG Fixes cython in splitting * REV Revert * Revert "REV Revert" This reverts commit d1cf3b1. * WIP Uses signed char * WIP Maybe use signed chars * WIP const signed chars
1 parent 04e485e commit 2431ea3

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

sklearn/ensemble/_hist_gradient_boosting/splitting.pyx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ cdef class Splitter:
134134
const unsigned int [::1] n_bins_non_missing
135135
unsigned char missing_values_bin_idx
136136
const unsigned char [::1] has_missing_values
137-
const char [::1] monotonic_cst
137+
const signed char [::1] monotonic_cst
138138
unsigned char hessians_are_constant
139139
Y_DTYPE_C l2_regularization
140140
Y_DTYPE_C min_hessian_to_split
@@ -150,7 +150,7 @@ cdef class Splitter:
150150
const unsigned int [::1] n_bins_non_missing,
151151
const unsigned char missing_values_bin_idx,
152152
const unsigned char [::1] has_missing_values,
153-
const char [::1] monotonic_cst,
153+
const signed char [::1] monotonic_cst,
154154
Y_DTYPE_C l2_regularization,
155155
Y_DTYPE_C min_hessian_to_split=1e-3,
156156
unsigned int min_samples_leaf=20,
@@ -410,7 +410,7 @@ cdef class Splitter:
410410
split_info_struct split_info
411411
split_info_struct * split_infos
412412
const unsigned char [::1] has_missing_values = self.has_missing_values
413-
const char [::1] monotonic_cst = self.monotonic_cst
413+
const signed char [::1] monotonic_cst = self.monotonic_cst
414414

415415
with nogil:
416416

@@ -496,7 +496,7 @@ cdef class Splitter:
496496
Y_DTYPE_C sum_gradients,
497497
Y_DTYPE_C sum_hessians,
498498
Y_DTYPE_C value,
499-
char monotonic_cst,
499+
signed char monotonic_cst,
500500
Y_DTYPE_C lower_bound,
501501
Y_DTYPE_C upper_bound,
502502
split_info_struct * split_info) nogil: # OUT
@@ -610,7 +610,7 @@ cdef class Splitter:
610610
Y_DTYPE_C sum_gradients,
611611
Y_DTYPE_C sum_hessians,
612612
Y_DTYPE_C value,
613-
char monotonic_cst,
613+
signed char monotonic_cst,
614614
Y_DTYPE_C lower_bound,
615615
Y_DTYPE_C upper_bound,
616616
split_info_struct * split_info) nogil: # OUT
@@ -723,7 +723,7 @@ cdef inline Y_DTYPE_C _split_gain(
723723
Y_DTYPE_C sum_gradient_right,
724724
Y_DTYPE_C sum_hessian_right,
725725
Y_DTYPE_C loss_current_node,
726-
char monotonic_cst,
726+
signed char monotonic_cst,
727727
Y_DTYPE_C lower_bound,
728728
Y_DTYPE_C upper_bound,
729729
Y_DTYPE_C l2_regularization) nogil:
@@ -820,4 +820,4 @@ cpdef inline Y_DTYPE_C compute_node_value(
820820
elif value > upper_bound:
821821
value = upper_bound
822822

823-
return value
823+
return value

0 commit comments

Comments
 (0)