@@ -37,9 +37,6 @@ class BalanceCascade(SamplerMixin):
3737 If None, the random number generator is the RandomState instance used
3838 by np.random.
3939
40- verbose : bool, optional (default=True)
41- Whether or not to print information about the processing.
42-
4340 n_max_subset : int or None, optional (default=None)
4441 Maximum number of subsets to generate. By default, all data from
4542 the training will be selected that could lead to a large number of
@@ -87,10 +84,9 @@ class BalanceCascade(SamplerMixin):
8784
8885 """
8986 def __init__ (self , ratio = 'auto' , return_indices = False , random_state = None ,
90- verbose = True , n_max_subset = None , classifier = 'knn' ,
91- bootstrap = True , ** kwargs ):
92- super (BalanceCascade , self ).__init__ (ratio = ratio ,
93- verbose = verbose )
87+ n_max_subset = None , classifier = 'knn' , bootstrap = True ,
88+ ** kwargs ):
89+ super (BalanceCascade , self ).__init__ (ratio = ratio )
9490 self .return_indices = return_indices
9591 self .random_state = random_state
9692 self .classifier = classifier
@@ -242,17 +238,17 @@ def _sample(self, X, y):
242238 # Find the misclassified index to keep them for the next round
243239 idx_mis_class = idx_sel_from_maj [np .nonzero (pred_label !=
244240 N_y [idx_sel_from_maj ])]
245- if self .verbose :
246- print ("Elements misclassified: {}" .format (idx_mis_class ))
241+ self .logger .debug ('Elements misclassified: {}' .format (
242+ idx_mis_class ))
243+
247244 # Count how many random element will be selected
248245 if self .ratio == 'auto' :
249246 num_samples = self .stats_c_ [self .min_c_ ]
250247 else :
251248 num_samples = int (self .stats_c_ [self .min_c_ ] / self .ratio )
252249 num_samples -= idx_mis_class .size
253250
254- if self .verbose :
255- print ("Creation of the subset #{}" .format (n_subsets ))
251+ self .logger .debug ('Creation of the subset #{}' .format (n_subsets ))
256252
257253 # We found a new subset, increase the counter
258254 n_subsets += 1
@@ -279,13 +275,14 @@ def _sample(self, X, y):
279275 idx_sel_from_maj ),
280276 axis = 0 ))
281277
282- if self .verbose :
283- print ("Creation of the subset #" + str (n_subsets ))
278+ self .logger .debug ('Creation of the subset #{}' .format (
279+ n_subsets ))
280+
281+ # We found a new subset, increase the counter
282+ n_subsets += 1
284283
285- # We found a new subset, increase the counter
286- n_subsets += 1
287- if self .verbose :
288- print ('The number of subset achieved their maximum' )
284+ self .logger .debug ('The number of subset reached is'
285+ ' maximum.' )
289286
290287 # Also check that we will have enough sample to extract at the
291288 # next round
@@ -307,14 +304,14 @@ def _sample(self, X, y):
307304 idx_under .append (np .concatenate ((idx_min ,
308305 idx_sel_from_maj ),
309306 axis = 0 ))
310- if self .verbose :
311- print ( "Creation of the subset #" + str ( n_subsets ))
307+ self .logger . debug ( 'Creation of the subset #{}' . format (
308+ n_subsets ))
312309
313310 # We found a new subset, increase the counter
314311 n_subsets += 1
315312
316- if self .verbose :
317- print ( 'Not enough samples to continue creating subsets' )
313+ self .logger . debug ( 'Not enough samples to continue creating'
314+ ' subsets. ' )
318315
319316 if self .return_indices :
320317 return (np .array (X_resampled ), np .array (y_resampled ),
0 commit comments