@@ -219,14 +219,26 @@ cdef class CommonRegressorCriterion(Criterion):
219
219
- (self .weighted_n_left / weight * impurity_left)))
220
220
221
221
222
- cpdef _test_criterion_init (Criterion criterion,
223
- const DOUBLE_t[:, ::1 ] y,
224
- DOUBLE_t[:] sample_weight,
225
- double weighted_n_samples,
226
- SIZE_t[:] samples,
227
- SIZE_t start, SIZE_t end):
222
+ cdef int _ctest_criterion_init (Criterion criterion,
223
+ const DOUBLE_t[:, ::1 ] y,
224
+ DOUBLE_t[:] sample_weight,
225
+ double weighted_n_samples,
226
+ SIZE_t[:] samples,
227
+ SIZE_t start, SIZE_t end):
228
228
" Test purposes. Methods cannot be directly called from python."
229
- if criterion.init(y, sample_weight, weighted_n_samples, samples, start, end) != 0 :
229
+ cdef const DOUBLE_t[:, ::1 ] y2 = y
230
+ return criterion.init(y2, sample_weight, weighted_n_samples, samples, start, end)
231
+
232
+
233
+ def _test_criterion_init (Criterion criterion ,
234
+ const DOUBLE_t[:, ::1] y ,
235
+ DOUBLE_t[:] sample_weight ,
236
+ double weighted_n_samples ,
237
+ SIZE_t[:] samples ,
238
+ SIZE_t start , SIZE_t end ):
239
+ " Test purposes. Methods cannot be directly called from python."
240
+ if _ctest_criterion_init(criterion, y, sample_weight, weighted_n_samples,
241
+ samples, start, end) != 0 :
230
242
raise AssertionError (" Return is not 0." )
231
243
232
244
0 commit comments