14
14
#
15
15
# License: BSD 3 clause
16
16
17
-
18
-
19
17
import numbers
20
18
import warnings
21
19
from abc import ABCMeta
@@ -187,7 +185,7 @@ def fit(self, X, y, sample_weight=None, check_input=True,
187
185
max_leaf_nodes = (- 1 if self .max_leaf_nodes is None
188
186
else self .max_leaf_nodes )
189
187
190
- if isinstance (self .min_samples_leaf , ( numbers .Integral , np . integer ) ):
188
+ if isinstance (self .min_samples_leaf , numbers .Integral ):
191
189
if not 1 <= self .min_samples_leaf :
192
190
raise ValueError ("min_samples_leaf must be at least 1 "
193
191
"or in (0, 0.5], got %s"
@@ -200,7 +198,7 @@ def fit(self, X, y, sample_weight=None, check_input=True,
200
198
% self .min_samples_leaf )
201
199
min_samples_leaf = int (ceil (self .min_samples_leaf * n_samples ))
202
200
203
- if isinstance (self .min_samples_split , ( numbers .Integral , np . integer ) ):
201
+ if isinstance (self .min_samples_split , numbers .Integral ):
204
202
if not 2 <= self .min_samples_split :
205
203
raise ValueError ("min_samples_split must be an integer "
206
204
"greater than 1 or a float in (0.0, 1.0]; "
@@ -234,7 +232,7 @@ def fit(self, X, y, sample_weight=None, check_input=True,
234
232
'values are "auto", "sqrt" or "log2".' )
235
233
elif self .max_features is None :
236
234
max_features = self .n_features_
237
- elif isinstance (self .max_features , ( numbers .Integral , np . integer ) ):
235
+ elif isinstance (self .max_features , numbers .Integral ):
238
236
max_features = self .max_features
239
237
else : # float
240
238
if self .max_features > 0.0 :
@@ -254,7 +252,7 @@ def fit(self, X, y, sample_weight=None, check_input=True,
254
252
raise ValueError ("max_depth must be greater than zero. " )
255
253
if not (0 < max_features <= self .n_features_ ):
256
254
raise ValueError ("max_features must be in (0, n_features]" )
257
- if not isinstance (max_leaf_nodes , ( numbers .Integral , np . integer ) ):
255
+ if not isinstance (max_leaf_nodes , numbers .Integral ):
258
256
raise ValueError ("max_leaf_nodes must be integral number but was "
259
257
"%r" % max_leaf_nodes )
260
258
if - 1 < max_leaf_nodes < 2 :
0 commit comments