@@ -53,8 +53,8 @@ cdef class Criterion:
53
53
54
54
cdef void init(self , DOUBLE_t* y, SIZE_t y_stride, DOUBLE_t* sample_weight,
55
55
double weighted_n_samples, SIZE_t* samples,
56
- SIZE_t start, SIZE_t end,
57
- SIZE_t start_missing, SIZE_t end_missing ) nogil:
56
+ SIZE_t* missing_samples, SIZE_t start, SIZE_t end,
57
+ SIZE_t missing_direction ) nogil:
58
58
""" Placeholder for a method which will initialize the criterion.
59
59
60
60
Parameters
@@ -77,10 +77,12 @@ cdef class Criterion:
77
77
The first non-missing-valued sample to be used on this node
78
78
end: SIZE_t
79
79
The last non-missing-valued sample used on this node
80
- start_missing: SIZE_t
81
- The first missing-valued sample to be used on this node
82
- end_missing: SIZE_t
83
- The last missing-valued sample used on this node
80
+ missing_direction: SIZE_t
81
+ The initial value of the direction in which the missing values
82
+ must be sent to
83
+ 0 - To send the missing values left
84
+ 1 - To send the missing values right
85
+ 2 - To ignore the missing values
84
86
85
87
"""
86
88
@@ -101,7 +103,7 @@ cdef class Criterion:
101
103
"""
102
104
pass
103
105
104
- cdef void update (self , SIZE_t new_pos) nogil:
106
+ cdef void update_split_pos (self , SIZE_t new_pos) nogil:
105
107
""" Updated statistics by moving samples[pos:new_pos] to the left child.
106
108
107
109
This updates the collected statistics by moving samples[pos:new_pos]
@@ -116,18 +118,19 @@ cdef class Criterion:
116
118
117
119
pass
118
120
119
- cdef void move_missing (self , bint direction ) nogil:
121
+ cdef void update_missing_direction (self , SIZE_t missing_direction ) nogil:
120
122
""" Updated statistics by moving the missing-valued samples to l/r.
121
123
122
124
This updates the collected statistics by moving the missing-valued
123
- samples (samples[start_missing:end_nonmissing]) to the direction as
124
- specified.
125
+ samples to the direction as specified.
125
126
126
127
Parameters
127
128
----------
128
- direction: bint
129
- 0 (false) to move the missing-valued samples left.
130
- 1 (true) to move the missing-valued samples right.
129
+ missing_direction: SIZE_t
130
+ Direction in which the missing values must be sent to
131
+ 0 - To send the missing values left
132
+ 1 - To send the missing values right
133
+ 2 - To ignore the missing values
131
134
132
135
"""
133
136
@@ -254,12 +257,10 @@ cdef class ClassificationCriterion(Criterion):
254
257
self .sample_weight = NULL
255
258
256
259
self .samples = NULL
257
- self .start_nonmissing = 0
258
- self .pos_nonmissing = 0
259
- self .end_nonmissing = 0
260
-
261
- self .start_missing = 0
262
- self .end_missing = 0
260
+ self .start = 0
261
+ self .pos = 0
262
+ self .end = 0
263
+ self .missing_direction = 2 # Ignore the missing values by default
263
264
264
265
self .n_outputs = n_outputs
265
266
0 commit comments