Skip to content

Commit c3900a6

Browse files
committed
removing sklearn.cross_validation DeprecationWarning issue #195
1 parent 7a5afeb commit c3900a6

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

imblearn/under_sampling/instance_hardness_threshold.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@
1010

1111
from sklearn.base import ClassifierMixin
1212
from sklearn.ensemble import RandomForestClassifier
13-
from sklearn.cross_validation import StratifiedKFold
13+
14+
import sklearn
15+
16+
if hasattr(sklearn, 'model_selection'):
17+
from sklearn.model_selection import StratifiedKFold
18+
else:
19+
from sklearn.cross_validation import StratifiedKFold
1420

1521
from six import string_types
1622

@@ -225,8 +231,8 @@ def _sample(self, X, y):
225231
"""
226232

227233
# Create the different folds
228-
skf = StratifiedKFold(y, n_folds=self.cv, shuffle=False,
229-
random_state=self.random_state)
234+
skf = list(StratifiedKFold(y, n_folds=self.cv, shuffle=False,
235+
random_state=self.random_state))
230236

231237
probabilities = np.zeros(y.shape[0], dtype=float)
232238

0 commit comments

Comments
 (0)