Skip to content

Commit 6fc3207

Browse files
authored
MAINT: create private modules when they should (#452)
closes #422
1 parent 6916fe9 commit 6fc3207

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+60
-62
lines changed

imblearn/combine/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
over-sampling and under-sampling.
33
"""
44

5-
from .smote_enn import SMOTEENN
6-
from .smote_tomek import SMOTETomek
5+
from ._smote_enn import SMOTEENN
6+
from ._smote_tomek import SMOTETomek
77

88
__all__ = ['SMOTEENN', 'SMOTETomek']

imblearn/combine/smote_enn.py renamed to imblearn/combine/_smote_enn.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from __future__ import division
88

99
import logging
10-
import warnings
1110

1211
from sklearn.base import clone
1312
from sklearn.utils import check_X_y

imblearn/combine/smote_tomek.py renamed to imblearn/combine/_smote_tomek.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from __future__ import division
99

1010
import logging
11-
import warnings
1211

1312
from sklearn.base import clone
1413
from sklearn.utils import check_X_y

imblearn/datasets/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
imbalanced data.
44
"""
55

6-
from .imbalance import make_imbalance
6+
from ._imbalance import make_imbalance
77

8-
from .zenodo import fetch_datasets
8+
from ._zenodo import fetch_datasets
99

1010
__all__ = ['make_imbalance', 'fetch_datasets']

imblearn/datasets/imbalance.py renamed to imblearn/datasets/_imbalance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
from sklearn.utils import check_X_y
1313

14-
from ..under_sampling.prototype_selection import RandomUnderSampler
14+
from ..under_sampling import RandomUnderSampler
1515
from ..utils import check_sampling_strategy
1616

1717
LOGGER = logging.getLogger(__name__)
File renamed without changes.

imblearn/ensemble/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
under-sampled subsets combined inside an ensemble.
44
"""
55

6-
from .easy_ensemble import EasyEnsemble
7-
from .balance_cascade import BalanceCascade
6+
from ._easy_ensemble import EasyEnsemble
7+
from ._balance_cascade import BalanceCascade
88

9-
from .classifier import BalancedBaggingClassifier
9+
from ._classifier import BalancedBaggingClassifier
1010

1111
__all__ = ['EasyEnsemble', 'BalancedBaggingClassifier', 'BalanceCascade']
File renamed without changes.

imblearn/metrics/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
metrics and pairwise metrics and distance computations.
44
"""
55

6-
from .classification import sensitivity_specificity_support
7-
from .classification import sensitivity_score
8-
from .classification import specificity_score
9-
from .classification import geometric_mean_score
10-
from .classification import make_index_balanced_accuracy
11-
from .classification import classification_report_imbalanced
6+
from ._classification import sensitivity_specificity_support
7+
from ._classification import sensitivity_score
8+
from ._classification import specificity_score
9+
from ._classification import geometric_mean_score
10+
from ._classification import make_index_balanced_accuracy
11+
from ._classification import classification_report_imbalanced
1212

1313
__all__ = [
1414
'sensitivity_specificity_support', 'sensitivity_score',

imblearn/over_sampling/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
perform over-sampling.
44
"""
55

6-
from .adasyn import ADASYN
7-
from .random_over_sampler import RandomOverSampler
8-
from .smote import SMOTE
9-
from .smote import BorderlineSMOTE
10-
from .smote import SVMSMOTE
6+
from ._adasyn import ADASYN
7+
from ._random_over_sampler import RandomOverSampler
8+
from ._smote import SMOTE
9+
from ._smote import BorderlineSMOTE
10+
from ._smote import SVMSMOTE
1111

1212
__all__ = ['ADASYN', 'RandomOverSampler',
1313
'SMOTE', 'BorderlineSMOTE', 'SVMSMOTE']
File renamed without changes.
File renamed without changes.

imblearn/under_sampling/__init__.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
a dataset.
44
"""
55

6-
from .prototype_generation import ClusterCentroids
6+
from ._prototype_generation import ClusterCentroids
77

8-
from .prototype_selection import RandomUnderSampler
9-
from .prototype_selection import TomekLinks
10-
from .prototype_selection import NearMiss
11-
from .prototype_selection import CondensedNearestNeighbour
12-
from .prototype_selection import OneSidedSelection
13-
from .prototype_selection import NeighbourhoodCleaningRule
14-
from .prototype_selection import EditedNearestNeighbours
15-
from .prototype_selection import RepeatedEditedNearestNeighbours
16-
from .prototype_selection import AllKNN
17-
from .prototype_selection import InstanceHardnessThreshold
8+
from ._prototype_selection import RandomUnderSampler
9+
from ._prototype_selection import TomekLinks
10+
from ._prototype_selection import NearMiss
11+
from ._prototype_selection import CondensedNearestNeighbour
12+
from ._prototype_selection import OneSidedSelection
13+
from ._prototype_selection import NeighbourhoodCleaningRule
14+
from ._prototype_selection import EditedNearestNeighbours
15+
from ._prototype_selection import RepeatedEditedNearestNeighbours
16+
from ._prototype_selection import AllKNN
17+
from ._prototype_selection import InstanceHardnessThreshold
1818

1919
__all__ = [
2020
'ClusterCentroids', 'RandomUnderSampler', 'InstanceHardnessThreshold',

imblearn/under_sampling/prototype_generation/__init__.py renamed to imblearn/under_sampling/_prototype_generation/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
methods that generate new samples in order to balance the dataset.
44
"""
55

6-
from .cluster_centroids import ClusterCentroids
6+
from ._cluster_centroids import ClusterCentroids
77

88
__all__ = ['ClusterCentroids']
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"""
2+
The :mod:`imblearn.under_sampling.prototype_selection` submodule contains
3+
methods that select samples in order to balance the dataset.
4+
"""
5+
6+
from ._random_under_sampler import RandomUnderSampler
7+
from ._tomek_links import TomekLinks
8+
from ._nearmiss import NearMiss
9+
from ._condensed_nearest_neighbour import CondensedNearestNeighbour
10+
from ._one_sided_selection import OneSidedSelection
11+
from ._neighbourhood_cleaning_rule import NeighbourhoodCleaningRule
12+
from ._edited_nearest_neighbours import EditedNearestNeighbours
13+
from ._edited_nearest_neighbours import RepeatedEditedNearestNeighbours
14+
from ._edited_nearest_neighbours import AllKNN
15+
from ._instance_hardness_threshold import InstanceHardnessThreshold
16+
17+
__all__ = [
18+
'RandomUnderSampler', 'InstanceHardnessThreshold', 'NearMiss',
19+
'TomekLinks', 'EditedNearestNeighbours', 'RepeatedEditedNearestNeighbours',
20+
'AllKNN', 'OneSidedSelection', 'CondensedNearestNeighbour',
21+
'NeighbourhoodCleaningRule'
22+
]

imblearn/under_sampling/prototype_selection/neighbourhood_cleaning_rule.py renamed to imblearn/under_sampling/_prototype_selection/_neighbourhood_cleaning_rule.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from sklearn.utils import safe_indexing
1515

1616
from ..base import BaseCleaningSampler
17-
from .edited_nearest_neighbours import EditedNearestNeighbours
17+
from ._edited_nearest_neighbours import EditedNearestNeighbours
1818
from ...utils import check_neighbors_object
1919
from ...utils import Substitution
2020
from ...utils.deprecation import deprecate_parameter

imblearn/under_sampling/prototype_selection/one_sided_selection.py renamed to imblearn/under_sampling/_prototype_selection/_one_sided_selection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from sklearn.utils import check_random_state, safe_indexing
1616

1717
from ..base import BaseCleaningSampler
18-
from .tomek_links import TomekLinks
18+
from ._tomek_links import TomekLinks
1919
from ...utils import Substitution
2020
from ...utils._docstring import _random_state_docstring
2121

imblearn/under_sampling/prototype_selection/__init__.py

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

imblearn/utils/__init__.py

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

55
from ._docstring import Substitution
66

7-
from .validation import check_neighbors_object
8-
from .validation import check_target_type
9-
from .validation import hash_X_y
10-
from .validation import check_ratio
11-
from .validation import check_sampling_strategy
7+
from ._validation import check_neighbors_object
8+
from ._validation import check_target_type
9+
from ._validation import hash_X_y
10+
from ._validation import check_ratio
11+
from ._validation import check_sampling_strategy
1212

1313
__all__ = [
1414
'Substitution', 'check_neighbors_object', 'check_target_type', 'hash_X_y',
File renamed without changes.

0 commit comments

Comments
 (0)