@@ -229,7 +229,7 @@ def _make_samples(self, X, y_type, nn_data, nn_num, n_samples,
229229 # minority label
230230 y_new = np .array ([y_type ] * len (X_new ))
231231
232- self .logger .info ('Generated {} new samples ...' . format ( len (X_new ) ))
232+ self .logger .info ('Generated %s new samples ...' , len (X_new ))
233233
234234 return X_new , y_new
235235
@@ -276,8 +276,7 @@ def _sample(self, X, y):
276276 # If regular SMOTE is to be performed
277277 if self .kind == 'regular' :
278278
279- self .logger .debug ('Finding the {} nearest neighbours...' .format (
280- self .k ))
279+ self .logger .debug ('Finding the %s nearest neighbours ...' , self .k )
281280
282281 # Look for k-th nearest neighbours, excluding, of course, the
283282 # point itself.
@@ -308,8 +307,7 @@ def _sample(self, X, y):
308307
309308 if self .kind == 'borderline1' or self .kind == 'borderline2' :
310309
311- self .logger .debug ('Finding the {} nearest neighbours ...' .format (
312- self .m ))
310+ self .logger .debug ('Finding the %s nearest neighbours ...' , self .m )
313311
314312 # Find the NNs for all samples in the data set.
315313 self .nearest_neighbour .fit (X )
@@ -413,8 +411,7 @@ def _sample(self, X, y):
413411
414412 # First, find the nn of all the samples to identify samples
415413 # in danger and noisy ones
416- self .logger .debug ('Finding the {} nearest neighbours ...' .format (
417- self .m ))
414+ self .logger .debug ('Finding the %s nearest neighbours ...' , self .m )
418415
419416 # As usual, fit a nearest neighbour model to the data
420417 self .nearest_neighbour .fit (X )
@@ -428,17 +425,16 @@ def _sample(self, X, y):
428425 kind = 'danger' )
429426 safety_bool = np .logical_not (danger_bool )
430427
431- self .logger .debug ('Out of {0} support vectors, {1} are noisy, '
432- '{2} are in danger '
433- 'and {3} are safe.' . format (
434- support_vector .shape [0 ],
435- noise_bool .sum ().astype (int ),
436- danger_bool .sum ().astype (int ),
437- safety_bool .sum ().astype (int ) ))
428+ self .logger .debug ('Out of %s support vectors, %s are noisy, '
429+ '%s are in danger '
430+ 'and %s are safe.' ,
431+ support_vector .shape [0 ],
432+ noise_bool .sum ().astype (int ),
433+ danger_bool .sum ().astype (int ),
434+ safety_bool .sum ().astype (int ))
438435
439436 # Proceed to find support vectors NNs among the minority class
440- self .logger .debug ('Finding the {} nearest neighbours ...' .format (
441- self .k ))
437+ self .logger .debug ('Finding the %s nearest neighbours ...' , self .k )
442438
443439 self .nearest_neighbour .set_params (** {'n_neighbors' : self .k + 1 })
444440 self .nearest_neighbour .fit (X_min )
0 commit comments