Skip to content

Commit 6482830

Browse files
author
Guillaume Lemaitre
committed
move the logger at init and use a copy of the dictionary
1 parent 445c7c6 commit 6482830

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

imblearn/base.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def __init__(self, ratio='auto', verbose=True):
5454

5555
self.ratio = ratio
5656
self.verbose = verbose
57+
self.logger = logging.getLogger(__name__)
5758

5859
def fit(self, X, y):
5960
"""Find the classes statistics before to perform sampling.
@@ -73,9 +74,6 @@ def fit(self, X, y):
7374
7475
"""
7576

76-
# Create logger
77-
self.logger = logging.getLogger(__name__)
78-
7977
# Check the consistency of X and y
8078
X, y = check_X_y(X, y)
8179

@@ -228,6 +226,6 @@ def _sample(self, X, y):
228226

229227
def __getstate__(self):
230228
"""Prevent logger from being pickled"""
231-
object_dictionary = dict(self.__dict__)
229+
object_dictionary = self.__dict__.copy()
232230
del object_dictionary['logger']
233231
return object_dictionary

0 commit comments

Comments
 (0)