Skip to content

Commit

Permalink
move the logger at init and use a copy of the dictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Lemaitre committed Jul 4, 2016
1 parent 142077d commit 912390f
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions imblearn/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def __init__(self, ratio='auto', verbose=True):

self.ratio = ratio
self.verbose = verbose
self.logger = logging.getLogger(__name__)

def fit(self, X, y):
"""Find the classes statistics before to perform sampling.
Expand All @@ -73,9 +74,6 @@ def fit(self, X, y):
"""

# Create logger
self.logger = logging.getLogger(__name__)

# Check the consistency of X and y
X, y = check_X_y(X, y)

Expand Down Expand Up @@ -228,6 +226,6 @@ def _sample(self, X, y):

def __getstate__(self):
"""Prevent logger from being pickled"""
object_dictionary = dict(self.__dict__)
object_dictionary = self.__dict__.copy()
del object_dictionary['logger']
return object_dictionary

0 comments on commit 912390f

Please sign in to comment.