Skip to content

Commit cd972c5

Browse files
author
chkoar
committed
make travis happy
1 parent aa1f233 commit cd972c5

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

imblearn/ensemble/easy_ensemble_generalization.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33
# Authors: Christos Aridas
44
#
55
# License: MIT
6+
from __future__ import print_function
67

78
import numpy as np
89
from sklearn.base import ClassifierMixin, clone
910
from sklearn.ensemble import VotingClassifier
1011
from sklearn.ensemble.base import BaseEnsemble, _set_random_states
1112
from sklearn.tree import DecisionTreeClassifier
1213
from sklearn.utils import check_random_state
14+
from sklearn.utils.multiclass import check_classification_targets
1315
from sklearn.utils.validation import check_is_fitted
1416

1517
from ..pipeline import Pipeline
@@ -63,13 +65,13 @@ class EasyEnsembleGeneralization(BaseEnsemble, ClassifierMixin):
6365
6466
Examples
6567
--------
66-
>>>import numpy as np
67-
>>>from imblearn.ensemble import EasyEnsembleGeneralization as EEG
68-
>>>X = np.array([[-1, -1], [-2, -1], [-3, -2], [1, 1], [2, 1], [3, 2]])
69-
>>>y = np.array([1, 1, 1, 2, 2, 2])
70-
>>>eeg = EEG(voting='hard', random_state=0)
71-
>>>eeg.fit(X,y)
72-
>>>eeg.predict(X)
68+
>>> import numpy as np
69+
>>> from imblearn.ensemble import EasyEnsembleGeneralization as EEG
70+
>>> X = np.array([[-1, -1], [-2, -1], [-3, -2], [1, 1], [2, 1], [3, 2]])
71+
>>> y = np.array([1, 1, 1, 2, 2, 2])
72+
>>> eeg = EEG(voting='soft', random_state=0)
73+
>>> eeg = eeg.fit(X,y)
74+
>>> print(eeg.predict(X))
7375
[1 1 1 2 2 2]
7476
>>>
7577
"""
@@ -129,6 +131,9 @@ def fit(self, X, y, sample_weight=None):
129131
Returns self.
130132
"""
131133

134+
135+
check_classification_targets(y)
136+
132137
random_state = check_random_state(self.random_state)
133138

134139
self._validate_estimator()

0 commit comments

Comments
 (0)