@@ -32,11 +32,11 @@ cdef class Criterion:
32
32
cdef intp_t n_outputs # Number of outputs
33
33
cdef intp_t n_samples # Number of samples
34
34
cdef intp_t n_node_samples # Number of samples in the node (end-start)
35
- cdef double weighted_n_samples # Weighted number of samples (in total)
36
- cdef double weighted_n_node_samples # Weighted number of samples in the node
37
- cdef double weighted_n_left # Weighted number of samples in the left node
38
- cdef double weighted_n_right # Weighted number of samples in the right node
39
- cdef double weighted_n_missing # Weighted number of samples that are missing
35
+ cdef float64_t weighted_n_samples # Weighted number of samples (in total)
36
+ cdef float64_t weighted_n_node_samples # Weighted number of samples in the node
37
+ cdef float64_t weighted_n_left # Weighted number of samples in the left node
38
+ cdef float64_t weighted_n_right # Weighted number of samples in the right node
39
+ cdef float64_t weighted_n_missing # Weighted number of samples that are missing
40
40
41
41
# The criterion object is maintained such that left and right collected
42
42
# statistics correspond to samples[start:pos] and samples[pos:end].
@@ -46,7 +46,7 @@ cdef class Criterion:
46
46
self ,
47
47
const float64_t[:, ::1 ] y,
48
48
const float64_t[:] sample_weight,
49
- double weighted_n_samples,
49
+ float64_t weighted_n_samples,
50
50
const intp_t[:] sample_indices,
51
51
intp_t start,
52
52
intp_t end
@@ -56,43 +56,43 @@ cdef class Criterion:
56
56
cdef int reset(self ) except - 1 nogil
57
57
cdef int reverse_reset(self ) except - 1 nogil
58
58
cdef int update(self , intp_t new_pos) except - 1 nogil
59
- cdef double node_impurity(self ) noexcept nogil
59
+ cdef float64_t node_impurity(self ) noexcept nogil
60
60
cdef void children_impurity(
61
61
self ,
62
- double * impurity_left,
63
- double * impurity_right
62
+ float64_t * impurity_left,
63
+ float64_t * impurity_right
64
64
) noexcept nogil
65
65
cdef void node_value(
66
66
self ,
67
- double * dest
67
+ float64_t * dest
68
68
) noexcept nogil
69
69
cdef void clip_node_value(
70
70
self ,
71
- double * dest,
72
- double lower_bound,
73
- double upper_bound
71
+ float64_t * dest,
72
+ float64_t lower_bound,
73
+ float64_t upper_bound
74
74
) noexcept nogil
75
- cdef double middle_value(self ) noexcept nogil
76
- cdef double impurity_improvement(
75
+ cdef float64_t middle_value(self ) noexcept nogil
76
+ cdef float64_t impurity_improvement(
77
77
self ,
78
- double impurity_parent,
79
- double impurity_left,
80
- double impurity_right
78
+ float64_t impurity_parent,
79
+ float64_t impurity_left,
80
+ float64_t impurity_right
81
81
) noexcept nogil
82
- cdef double proxy_impurity_improvement(self ) noexcept nogil
82
+ cdef float64_t proxy_impurity_improvement(self ) noexcept nogil
83
83
cdef bint check_monotonicity(
84
84
self ,
85
85
cnp.int8_t monotonic_cst,
86
- double lower_bound,
87
- double upper_bound,
86
+ float64_t lower_bound,
87
+ float64_t upper_bound,
88
88
) noexcept nogil
89
89
cdef inline bint _check_monotonicity(
90
90
self ,
91
91
cnp.int8_t monotonic_cst,
92
- double lower_bound,
93
- double upper_bound,
94
- double sum_left,
95
- double sum_right,
92
+ float64_t lower_bound,
93
+ float64_t upper_bound,
94
+ float64_t sum_left,
95
+ float64_t sum_right,
96
96
) noexcept nogil
97
97
98
98
cdef class ClassificationCriterion(Criterion):
@@ -101,17 +101,17 @@ cdef class ClassificationCriterion(Criterion):
101
101
cdef intp_t[::1 ] n_classes
102
102
cdef intp_t max_n_classes
103
103
104
- cdef double [:, ::1 ] sum_total # The sum of the weighted count of each label.
105
- cdef double [:, ::1 ] sum_left # Same as above, but for the left side of the split
106
- cdef double [:, ::1 ] sum_right # Same as above, but for the right side of the split
107
- cdef double [:, ::1 ] sum_missing # Same as above, but for missing values in X
104
+ cdef float64_t [:, ::1 ] sum_total # The sum of the weighted count of each label.
105
+ cdef float64_t [:, ::1 ] sum_left # Same as above, but for the left side of the split
106
+ cdef float64_t [:, ::1 ] sum_right # Same as above, but for the right side of the split
107
+ cdef float64_t [:, ::1 ] sum_missing # Same as above, but for missing values in X
108
108
109
109
cdef class RegressionCriterion(Criterion):
110
110
""" Abstract regression criterion."""
111
111
112
- cdef double sq_sum_total
112
+ cdef float64_t sq_sum_total
113
113
114
- cdef double [::1 ] sum_total # The sum of w*y.
115
- cdef double [::1 ] sum_left # Same as above, but for the left side of the split
116
- cdef double [::1 ] sum_right # Same as above, but for the right side of the split
117
- cdef double [::1 ] sum_missing # Same as above, but for missing values in X
114
+ cdef float64_t [::1 ] sum_total # The sum of w*y.
115
+ cdef float64_t [::1 ] sum_left # Same as above, but for the left side of the split
116
+ cdef float64_t [::1 ] sum_right # Same as above, but for the right side of the split
117
+ cdef float64_t [::1 ] sum_missing # Same as above, but for missing values in X
0 commit comments