Skip to content

Commit e9d8f1a

Browse files
author
Guillaume Lemaitre
committed
Fix the name of the base class
1 parent 012da67 commit e9d8f1a

File tree

9 files changed

+18
-62
lines changed

9 files changed

+18
-62
lines changed

imblearn/base.py

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ def __setstate__(self, dict):
229229
self.logger = logger
230230

231231

232-
class BaseBinaryclassSampler(six.with_metaclass(ABCMeta, SamplerMixin)):
232+
class BaseBinarySampler(six.with_metaclass(ABCMeta, SamplerMixin)):
233233
"""Base class for all binary class sampler.
234234
235235
Warning: This class should not be used directly. Use derived classes
@@ -255,36 +255,14 @@ def fit(self, X, y):
255255
256256
"""
257257

258-
super(BaseBinaryclassSampler, self).fit(X, y)
258+
super(BaseBinarySampler, self).fit(X, y)
259259

260260
# Check that the target type is binary
261261
if not type_of_target(y) == 'binary':
262262
warnings.warn('The target type should be binary.')
263263

264264
return self
265265

266-
@abstractmethod
267-
def _sample(self, X, y):
268-
"""Resample the dataset.
269-
270-
Parameters
271-
----------
272-
X : ndarray, shape (n_samples, n_features)
273-
Matrix containing the data which have to be sampled.
274-
275-
y : ndarray, shape (n_samples, )
276-
Corresponding label for each sample in X.
277-
278-
Returns
279-
-------
280-
X_resampled : ndarray, shape (n_samples_new, n_features)
281-
The array containing the resampled data.
282-
283-
y_resampled : ndarray, shape (n_samples_new)
284-
The corresponding label of `X_resampled`
285-
"""
286-
pass
287-
288266

289267
class BaseMulticlassSampler(six.with_metaclass(ABCMeta, SamplerMixin)):
290268
"""Base class for all multiclass sampler.
@@ -320,25 +298,3 @@ def fit(self, X, y):
320298
warnings.warn('The target type should be binary or multiclass.')
321299

322300
return self
323-
324-
@abstractmethod
325-
def _sample(self, X, y):
326-
"""Resample the dataset.
327-
328-
Parameters
329-
----------
330-
X : ndarray, shape (n_samples, n_features)
331-
Matrix containing the data which have to be sampled.
332-
333-
y : ndarray, shape (n_samples, )
334-
Corresponding label for each sample in X.
335-
336-
Returns
337-
-------
338-
X_resampled : ndarray, shape (n_samples_new, n_features)
339-
The array containing the resampled data.
340-
341-
y_resampled : ndarray, shape (n_samples_new)
342-
The corresponding label of `X_resampled`
343-
"""
344-
pass

imblearn/combine/smote_enn.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
from ..over_sampling import SMOTE
66
from ..under_sampling import EditedNearestNeighbours
7-
from ..base import BaseBinaryclassSampler
7+
from ..base import BaseBinarySampler
88

99

10-
class SMOTEENN(BaseBinaryclassSampler):
10+
class SMOTEENN(BaseBinarySampler):
1111
"""Class to perform over-sampling using SMOTE and cleaning using ENN.
1212
1313
Combine over- and under-sampling using SMOTE and Edited Nearest Neighbours.

imblearn/combine/smote_tomek.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66
from ..over_sampling import SMOTE
77
from ..under_sampling import TomekLinks
8-
from ..base import BaseBinaryclassSampler
8+
from ..base import BaseBinarySampler
99

1010

11-
class SMOTETomek(BaseBinaryclassSampler):
11+
class SMOTETomek(BaseBinarySampler):
1212
"""Class to perform over-sampling using SMOTE and cleaning using
1313
Tomek links.
1414

imblearn/ensemble/balance_cascade.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55

66
from sklearn.utils import check_random_state
77

8-
from ..base import BaseBinaryclassSampler
8+
from ..base import BaseBinarySampler
99

1010

1111
ESTIMATOR_KIND = ('knn', 'decision-tree', 'random-forest', 'adaboost',
1212
'gradient-boosting', 'linear-svm')
1313

1414

15-
class BalanceCascade(BaseBinaryclassSampler):
15+
class BalanceCascade(BaseBinarySampler):
1616
"""Create an ensemble of balanced sets by iteratively under-sampling the
1717
imbalanced dataset using an estimator.
1818

imblearn/over_sampling/adasyn.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
from sklearn.neighbors import NearestNeighbors
1010
from sklearn.utils import check_random_state
1111

12-
from ..base import BaseBinaryclassSampler
12+
from ..base import BaseBinarySampler
1313

1414

15-
class ADASYN(BaseBinaryclassSampler):
15+
class ADASYN(BaseBinarySampler):
1616

1717
"""Perform over-sampling using ADASYN.
1818

imblearn/over_sampling/smote.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
from sklearn.neighbors import NearestNeighbors
1313
from sklearn.svm import SVC
1414

15-
from ..base import BaseBinaryclassSampler
15+
from ..base import BaseBinarySampler
1616

1717

1818
SMOTE_KIND = ('regular', 'borderline1', 'borderline2', 'svm')
1919

2020

21-
class SMOTE(BaseBinaryclassSampler):
21+
class SMOTE(BaseBinarySampler):
2222

2323
"""Class to perform over-sampling using SMOTE.
2424

imblearn/under_sampling/instance_hardness_threshold.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99

1010
from sklearn.cross_validation import StratifiedKFold
1111

12-
from ..base import BaseBinaryclassSampler
12+
from ..base import BaseBinarySampler
1313

1414

1515
ESTIMATOR_KIND = ('knn', 'decision-tree', 'random-forest', 'adaboost',
1616
'gradient-boosting', 'linear-svm')
1717

1818

19-
class InstanceHardnessThreshold(BaseBinaryclassSampler):
19+
class InstanceHardnessThreshold(BaseBinarySampler):
2020
"""Class to perform under-sampling based on the instance hardness
2121
threshold.
2222

imblearn/under_sampling/one_sided_selection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
from sklearn.neighbors import NearestNeighbors
1111
from sklearn.utils import check_random_state
1212

13-
from ..base import BaseBinaryclassSampler
13+
from ..base import BaseBinarySampler
1414
from .tomek_links import TomekLinks
1515

1616

17-
class OneSidedSelection(BaseBinaryclassSampler):
17+
class OneSidedSelection(BaseBinarySampler):
1818
"""Class to perform under-sampling based on one-sided selection method.
1919
2020
Parameters

imblearn/under_sampling/tomek_links.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88

99
from sklearn.neighbors import NearestNeighbors
1010

11-
from ..base import BaseBinaryclassSampler
11+
from ..base import BaseBinarySampler
1212

1313

14-
class TomekLinks(BaseBinaryclassSampler):
14+
class TomekLinks(BaseBinarySampler):
1515
"""Class to perform under-sampling by removing Tomek's links.
1616
1717
Parameters

0 commit comments

Comments
 (0)