@@ -309,7 +309,7 @@ def fit(self, X, y, sample_weight=None, check_input=True):
309309
310310 return self
311311
312- def predict (self , X ):
312+ def predict (self , X , check_input = True ):
313313 """Predict class or regression value for X.
314314
315315 For a classification model, the predicted class for each sample in X is
@@ -323,16 +323,21 @@ def predict(self, X):
323323 ``dtype=np.float32`` and if a sparse matrix is provided
324324 to a sparse ``csr_matrix``.
325325
326+ check_input : boolean, (default=True)
327+ Allow to bypass several input checking.
328+ Don't use this parameter unless you know what you do.
329+
326330 Returns
327331 -------
328332 y : array of shape = [n_samples] or [n_samples, n_outputs]
329333 The predicted classes, or the predict values.
330334 """
331- X = check_array (X , dtype = DTYPE , accept_sparse = "csr" )
332- if issparse (X ) and (X .indices .dtype != np .intc or
333- X .indptr .dtype != np .intc ):
334- raise ValueError ("No support for np.int64 index based "
335- "sparse matrices" )
335+ if check_input :
336+ X = check_array (X , dtype = DTYPE , accept_sparse = "csr" )
337+ if issparse (X ) and (X .indices .dtype != np .intc or
338+ X .indptr .dtype != np .intc ):
339+ raise ValueError ("No support for np.int64 index based "
340+ "sparse matrices" )
336341
337342 n_samples , n_features = X .shape
338343
@@ -568,12 +573,16 @@ def __init__(self,
568573 class_weight = class_weight ,
569574 random_state = random_state )
570575
571- def predict_proba (self , X ):
576+ def predict_proba (self , X , check_input = True ):
572577 """Predict class probabilities of the input samples X.
573578
574579 The predicted class probability is the fraction of samples of the same
575580 class in a leaf.
576581
582+ check_input : boolean, (default=True)
583+ Allow to bypass several input checking.
584+ Don't use this parameter unless you know what you do.
585+
577586 Parameters
578587 ----------
579588 X : array-like or sparse matrix of shape = [n_samples, n_features]
@@ -589,11 +598,12 @@ class in a leaf.
589598 classes corresponds to that in the attribute `classes_`.
590599 """
591600 check_is_fitted (self , 'n_outputs_' )
592- X = check_array (X , dtype = DTYPE , accept_sparse = "csr" )
593- if issparse (X ) and (X .indices .dtype != np .intc or
594- X .indptr .dtype != np .intc ):
595- raise ValueError ("No support for np.int64 index based "
596- "sparse matrices" )
601+ if check_input :
602+ X = check_array (X , dtype = DTYPE , accept_sparse = "csr" )
603+ if issparse (X ) and (X .indices .dtype != np .intc or
604+ X .indptr .dtype != np .intc ):
605+ raise ValueError ("No support for np.int64 index based "
606+ "sparse matrices" )
597607
598608 n_samples , n_features = X .shape
599609
0 commit comments