@@ -91,6 +91,13 @@ cdef class Splitter:
9191 def __setstate__ (self , d ):
9292 pass
9393
94+ def __reduce__ (self ):
95+ return (type (self ), (self .criterion,
96+ self .max_features,
97+ self .min_samples_leaf,
98+ self .min_weight_leaf,
99+ self .random_state), self .__getstate__())
100+
94101 cdef int init(
95102 self ,
96103 object X,
@@ -240,13 +247,6 @@ cdef class BaseDenseSplitter(Splitter):
240247
241248cdef class BestSplitter(BaseDenseSplitter):
242249 """ Splitter for finding the best split."""
243- def __reduce__ (self ):
244- return (BestSplitter, (self .criterion,
245- self .max_features,
246- self .min_samples_leaf,
247- self .min_weight_leaf,
248- self .random_state), self .__getstate__())
249-
250250 cdef int node_split(self , double impurity, SplitRecord* split,
251251 SIZE_t* n_constant_features) nogil except - 1 :
252252 """ Find the best split on node samples[start:end]
@@ -553,13 +553,6 @@ cdef void heapsort(DTYPE_t* Xf, SIZE_t* samples, SIZE_t n) nogil:
553553
554554cdef class RandomSplitter(BaseDenseSplitter):
555555 """ Splitter for finding the best random split."""
556- def __reduce__ (self ):
557- return (RandomSplitter, (self .criterion,
558- self .max_features,
559- self .min_samples_leaf,
560- self .min_weight_leaf,
561- self .random_state), self .__getstate__())
562-
563556 cdef int node_split(self , double impurity, SplitRecord* split,
564557 SIZE_t* n_constant_features) nogil except - 1 :
565558 """ Find the best random split on node samples[start:end]
@@ -1057,14 +1050,6 @@ cdef inline void sparse_swap(SIZE_t[::1] index_to_samples, SIZE_t[::1] samples,
10571050
10581051cdef class BestSparseSplitter(BaseSparseSplitter):
10591052 """ Splitter for finding the best split, using the sparse data."""
1060-
1061- def __reduce__ (self ):
1062- return (BestSparseSplitter, (self .criterion,
1063- self .max_features,
1064- self .min_samples_leaf,
1065- self .min_weight_leaf,
1066- self .random_state), self .__getstate__())
1067-
10681053 cdef int node_split(self , double impurity, SplitRecord* split,
10691054 SIZE_t* n_constant_features) nogil except - 1 :
10701055 """ Find the best split on node samples[start:end], using sparse features
@@ -1283,14 +1268,6 @@ cdef class BestSparseSplitter(BaseSparseSplitter):
12831268
12841269cdef class RandomSparseSplitter(BaseSparseSplitter):
12851270 """ Splitter for finding a random split, using the sparse data."""
1286-
1287- def __reduce__ (self ):
1288- return (RandomSparseSplitter, (self .criterion,
1289- self .max_features,
1290- self .min_samples_leaf,
1291- self .min_weight_leaf,
1292- self .random_state), self .__getstate__())
1293-
12941271 cdef int node_split(self , double impurity, SplitRecord* split,
12951272 SIZE_t* n_constant_features) nogil except - 1 :
12961273 """ Find a random split on node samples[start:end], using sparse features
0 commit comments