Skip to content

Commit 0fcd502

Browse files
author
Guillaume Lemaitre
committed
Renaming the base class such as in sklearn
1 parent c02db3d commit 0fcd502

File tree

6 files changed

+12
-195
lines changed

6 files changed

+12
-195
lines changed

unbalanced_dataset/base_sampler.py

Lines changed: 0 additions & 183 deletions
This file was deleted.

unbalanced_dataset/combine/smote_enn.py

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

77
from ..over_sampling import SMOTE
88
from ..under_sampling import EditedNearestNeighbours
9-
from ..base_sampler import BaseSampler
9+
from ..base import SamplerMixin
1010

1111

12-
class SMOTEENN(BaseSampler):
12+
class SMOTEENN(SamplerMixin):
1313
"""Class to perform over-sampling using SMOTE and cleaning using ENN.
1414
1515
Combine over- and under-sampling using SMOTE and Edited Nearest Neighbours.

unbalanced_dataset/combine/smote_tomek.py

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

77
from ..over_sampling import SMOTE
88
from ..under_sampling import TomekLinks
9-
from ..base_sampler import BaseSampler
9+
from ..base import SamplerMixin
1010

1111

12-
class SMOTETomek(BaseSampler):
12+
class SMOTETomek(SamplerMixin):
1313
"""Class to perform over-sampling using SMOTE and cleaning using
1414
Tomek links.
1515

unbalanced_dataset/ensemble/ensemble_sampler.py

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

55
from abc import ABCMeta, abstractmethod
66

7-
from ..base_sampler import BaseSampler
7+
from sklearn.externals import six
88

9+
from ..base import SamplerMixin
910

10-
class EnsembleSampler(BaseSampler):
11+
12+
class EnsembleSampler(six.with_metaclass(ABCMeta, SamplerMixin)):
1113
"""Base class for ensenble sampling.
1214
1315
Warning: This class should not be used directly. Use the derive classes
1416
instead.
1517
1618
"""
1719

18-
__metaclass__ = ABCMeta
19-
2020
@abstractmethod
2121
def __init__(self, ratio='auto', return_indices=False, random_state=None,
2222
verbose=True):

unbalanced_dataset/over_sampling/over_sampler.py

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

77
from sklearn.externals import six
88

9-
from ..base_sampler import BaseSampler
9+
from ..base import SamplerMixin
1010

1111

12-
class OverSampler(six.with_metaclass(ABCMeta, BaseSampler)):
12+
class OverSampler(six.with_metaclass(ABCMeta, SamplerMixin)):
1313
"""Base class for over-sampling.
1414
1515
Warning: This class should not be used directly. Use the derive classes

unbalanced_dataset/under_sampling/under_sampler.py

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

77
from sklearn.externals import six
88

9-
from ..base_sampler import BaseSampler
9+
from ..base import SamplerMixin
1010

1111

12-
class UnderSampler(six.with_metaclass(ABCMeta, BaseSampler)):
12+
class UnderSampler(six.with_metaclass(ABCMeta, SamplerMixin)):
1313
"""Base class for under-sampling.
1414
1515
Warning: This class should not be used directly. Use the derive classes

0 commit comments

Comments
 (0)