From 77a90c8be200286390d2f2aff8830c0d0ebafd2e Mon Sep 17 00:00:00 2001 From: Guillaume Lemaitre Date: Thu, 23 Aug 2018 16:15:24 +0200 Subject: [PATCH] MAINT: create private modules when they should --- imblearn/combine/__init__.py | 4 ++-- .../combine/{smote_enn.py => _smote_enn.py} | 1 - .../{smote_tomek.py => _smote_tomek.py} | 1 - imblearn/datasets/__init__.py | 4 ++-- .../datasets/{imbalance.py => _imbalance.py} | 2 +- imblearn/datasets/{zenodo.py => _zenodo.py} | 0 imblearn/ensemble/__init__.py | 6 ++--- ...balance_cascade.py => _balance_cascade.py} | 0 .../{classifier.py => _classifier.py} | 0 .../{easy_ensemble.py => _easy_ensemble.py} | 0 imblearn/metrics/__init__.py | 12 +++++----- .../{classification.py => _classification.py} | 0 imblearn/over_sampling/__init__.py | 10 ++++----- .../over_sampling/{adasyn.py => _adasyn.py} | 0 ...ver_sampler.py => _random_over_sampler.py} | 0 .../over_sampling/{smote.py => _smote.py} | 0 imblearn/under_sampling/__init__.py | 22 +++++++++---------- .../__init__.py | 2 +- .../_cluster_centroids.py} | 0 .../tests/__init__.py | 0 .../tests/test_cluster_centroids.py | 0 .../_prototype_selection/__init__.py | 22 +++++++++++++++++++ .../_condensed_nearest_neighbour.py} | 0 .../_edited_nearest_neighbours.py} | 0 .../_instance_hardness_threshold.py} | 0 .../_nearmiss.py} | 0 .../_neighbourhood_cleaning_rule.py} | 2 +- .../_one_sided_selection.py} | 2 +- .../_random_under_sampler.py} | 0 .../_tomek_links.py} | 0 .../tests/__init__.py | 0 .../tests/test_allknn.py | 0 .../tests/test_condensed_nearest_neighbour.py | 0 .../tests/test_edited_nearest_neighbours.py | 0 .../tests/test_instance_hardness_threshold.py | 0 .../tests/test_nearmiss.py | 0 .../tests/test_neighbourhood_cleaning_rule.py | 0 .../tests/test_one_sided_selection.py | 0 .../tests/test_random_under_sampler.py | 0 ...test_repeated_edited_nearest_neighbours.py | 0 .../tests/test_tomek_links.py | 0 .../prototype_selection/__init__.py | 22 ------------------- imblearn/utils/__init__.py | 10 ++++----- .../utils/{validation.py => _validation.py} | 0 44 files changed, 60 insertions(+), 62 deletions(-) rename imblearn/combine/{smote_enn.py => _smote_enn.py} (99%) rename imblearn/combine/{smote_tomek.py => _smote_tomek.py} (99%) rename imblearn/datasets/{imbalance.py => _imbalance.py} (98%) rename imblearn/datasets/{zenodo.py => _zenodo.py} (100%) rename imblearn/ensemble/{balance_cascade.py => _balance_cascade.py} (100%) rename imblearn/ensemble/{classifier.py => _classifier.py} (100%) rename imblearn/ensemble/{easy_ensemble.py => _easy_ensemble.py} (100%) rename imblearn/metrics/{classification.py => _classification.py} (100%) rename imblearn/over_sampling/{adasyn.py => _adasyn.py} (100%) rename imblearn/over_sampling/{random_over_sampler.py => _random_over_sampler.py} (100%) rename imblearn/over_sampling/{smote.py => _smote.py} (100%) rename imblearn/under_sampling/{prototype_generation => _prototype_generation}/__init__.py (78%) rename imblearn/under_sampling/{prototype_generation/cluster_centroids.py => _prototype_generation/_cluster_centroids.py} (100%) rename imblearn/under_sampling/{prototype_generation => _prototype_generation}/tests/__init__.py (100%) rename imblearn/under_sampling/{prototype_generation => _prototype_generation}/tests/test_cluster_centroids.py (100%) create mode 100644 imblearn/under_sampling/_prototype_selection/__init__.py rename imblearn/under_sampling/{prototype_selection/condensed_nearest_neighbour.py => _prototype_selection/_condensed_nearest_neighbour.py} (100%) rename imblearn/under_sampling/{prototype_selection/edited_nearest_neighbours.py => _prototype_selection/_edited_nearest_neighbours.py} (100%) rename imblearn/under_sampling/{prototype_selection/instance_hardness_threshold.py => _prototype_selection/_instance_hardness_threshold.py} (100%) rename imblearn/under_sampling/{prototype_selection/nearmiss.py => _prototype_selection/_nearmiss.py} (100%) rename imblearn/under_sampling/{prototype_selection/neighbourhood_cleaning_rule.py => _prototype_selection/_neighbourhood_cleaning_rule.py} (99%) rename imblearn/under_sampling/{prototype_selection/one_sided_selection.py => _prototype_selection/_one_sided_selection.py} (99%) rename imblearn/under_sampling/{prototype_selection/random_under_sampler.py => _prototype_selection/_random_under_sampler.py} (100%) rename imblearn/under_sampling/{prototype_selection/tomek_links.py => _prototype_selection/_tomek_links.py} (100%) rename imblearn/under_sampling/{prototype_selection => _prototype_selection}/tests/__init__.py (100%) rename imblearn/under_sampling/{prototype_selection => _prototype_selection}/tests/test_allknn.py (100%) rename imblearn/under_sampling/{prototype_selection => _prototype_selection}/tests/test_condensed_nearest_neighbour.py (100%) rename imblearn/under_sampling/{prototype_selection => _prototype_selection}/tests/test_edited_nearest_neighbours.py (100%) rename imblearn/under_sampling/{prototype_selection => _prototype_selection}/tests/test_instance_hardness_threshold.py (100%) rename imblearn/under_sampling/{prototype_selection => _prototype_selection}/tests/test_nearmiss.py (100%) rename imblearn/under_sampling/{prototype_selection => _prototype_selection}/tests/test_neighbourhood_cleaning_rule.py (100%) rename imblearn/under_sampling/{prototype_selection => _prototype_selection}/tests/test_one_sided_selection.py (100%) rename imblearn/under_sampling/{prototype_selection => _prototype_selection}/tests/test_random_under_sampler.py (100%) rename imblearn/under_sampling/{prototype_selection => _prototype_selection}/tests/test_repeated_edited_nearest_neighbours.py (100%) rename imblearn/under_sampling/{prototype_selection => _prototype_selection}/tests/test_tomek_links.py (100%) delete mode 100644 imblearn/under_sampling/prototype_selection/__init__.py rename imblearn/utils/{validation.py => _validation.py} (100%) diff --git a/imblearn/combine/__init__.py b/imblearn/combine/__init__.py index 5f459411b..f203bd6f7 100644 --- a/imblearn/combine/__init__.py +++ b/imblearn/combine/__init__.py @@ -2,7 +2,7 @@ over-sampling and under-sampling. """ -from .smote_enn import SMOTEENN -from .smote_tomek import SMOTETomek +from ._smote_enn import SMOTEENN +from ._smote_tomek import SMOTETomek __all__ = ['SMOTEENN', 'SMOTETomek'] diff --git a/imblearn/combine/smote_enn.py b/imblearn/combine/_smote_enn.py similarity index 99% rename from imblearn/combine/smote_enn.py rename to imblearn/combine/_smote_enn.py index 942acec54..d1a1960f4 100644 --- a/imblearn/combine/smote_enn.py +++ b/imblearn/combine/_smote_enn.py @@ -7,7 +7,6 @@ from __future__ import division import logging -import warnings from sklearn.base import clone from sklearn.utils import check_X_y diff --git a/imblearn/combine/smote_tomek.py b/imblearn/combine/_smote_tomek.py similarity index 99% rename from imblearn/combine/smote_tomek.py rename to imblearn/combine/_smote_tomek.py index 0a53cdf2a..f94788d1f 100644 --- a/imblearn/combine/smote_tomek.py +++ b/imblearn/combine/_smote_tomek.py @@ -8,7 +8,6 @@ from __future__ import division import logging -import warnings from sklearn.base import clone from sklearn.utils import check_X_y diff --git a/imblearn/datasets/__init__.py b/imblearn/datasets/__init__.py index 355070127..88ca39e82 100644 --- a/imblearn/datasets/__init__.py +++ b/imblearn/datasets/__init__.py @@ -3,8 +3,8 @@ imbalanced data. """ -from .imbalance import make_imbalance +from ._imbalance import make_imbalance -from .zenodo import fetch_datasets +from ._zenodo import fetch_datasets __all__ = ['make_imbalance', 'fetch_datasets'] diff --git a/imblearn/datasets/imbalance.py b/imblearn/datasets/_imbalance.py similarity index 98% rename from imblearn/datasets/imbalance.py rename to imblearn/datasets/_imbalance.py index 98eba953a..332065a66 100644 --- a/imblearn/datasets/imbalance.py +++ b/imblearn/datasets/_imbalance.py @@ -11,7 +11,7 @@ from sklearn.utils import check_X_y -from ..under_sampling.prototype_selection import RandomUnderSampler +from ..under_sampling import RandomUnderSampler from ..utils import check_sampling_strategy LOGGER = logging.getLogger(__name__) diff --git a/imblearn/datasets/zenodo.py b/imblearn/datasets/_zenodo.py similarity index 100% rename from imblearn/datasets/zenodo.py rename to imblearn/datasets/_zenodo.py diff --git a/imblearn/ensemble/__init__.py b/imblearn/ensemble/__init__.py index 35cbd24eb..f66f5e1dc 100644 --- a/imblearn/ensemble/__init__.py +++ b/imblearn/ensemble/__init__.py @@ -3,9 +3,9 @@ under-sampled subsets combined inside an ensemble. """ -from .easy_ensemble import EasyEnsemble -from .balance_cascade import BalanceCascade +from ._easy_ensemble import EasyEnsemble +from ._balance_cascade import BalanceCascade -from .classifier import BalancedBaggingClassifier +from ._classifier import BalancedBaggingClassifier __all__ = ['EasyEnsemble', 'BalancedBaggingClassifier', 'BalanceCascade'] diff --git a/imblearn/ensemble/balance_cascade.py b/imblearn/ensemble/_balance_cascade.py similarity index 100% rename from imblearn/ensemble/balance_cascade.py rename to imblearn/ensemble/_balance_cascade.py diff --git a/imblearn/ensemble/classifier.py b/imblearn/ensemble/_classifier.py similarity index 100% rename from imblearn/ensemble/classifier.py rename to imblearn/ensemble/_classifier.py diff --git a/imblearn/ensemble/easy_ensemble.py b/imblearn/ensemble/_easy_ensemble.py similarity index 100% rename from imblearn/ensemble/easy_ensemble.py rename to imblearn/ensemble/_easy_ensemble.py diff --git a/imblearn/metrics/__init__.py b/imblearn/metrics/__init__.py index 037a200d9..e44452f3b 100644 --- a/imblearn/metrics/__init__.py +++ b/imblearn/metrics/__init__.py @@ -3,12 +3,12 @@ metrics and pairwise metrics and distance computations. """ -from .classification import sensitivity_specificity_support -from .classification import sensitivity_score -from .classification import specificity_score -from .classification import geometric_mean_score -from .classification import make_index_balanced_accuracy -from .classification import classification_report_imbalanced +from ._classification import sensitivity_specificity_support +from ._classification import sensitivity_score +from ._classification import specificity_score +from ._classification import geometric_mean_score +from ._classification import make_index_balanced_accuracy +from ._classification import classification_report_imbalanced __all__ = [ 'sensitivity_specificity_support', 'sensitivity_score', diff --git a/imblearn/metrics/classification.py b/imblearn/metrics/_classification.py similarity index 100% rename from imblearn/metrics/classification.py rename to imblearn/metrics/_classification.py diff --git a/imblearn/over_sampling/__init__.py b/imblearn/over_sampling/__init__.py index abfec8b80..75c4ed8eb 100644 --- a/imblearn/over_sampling/__init__.py +++ b/imblearn/over_sampling/__init__.py @@ -3,11 +3,11 @@ perform over-sampling. """ -from .adasyn import ADASYN -from .random_over_sampler import RandomOverSampler -from .smote import SMOTE -from .smote import BorderlineSMOTE -from .smote import SVMSMOTE +from ._adasyn import ADASYN +from ._random_over_sampler import RandomOverSampler +from ._smote import SMOTE +from ._smote import BorderlineSMOTE +from ._smote import SVMSMOTE __all__ = ['ADASYN', 'RandomOverSampler', 'SMOTE', 'BorderlineSMOTE', 'SVMSMOTE'] diff --git a/imblearn/over_sampling/adasyn.py b/imblearn/over_sampling/_adasyn.py similarity index 100% rename from imblearn/over_sampling/adasyn.py rename to imblearn/over_sampling/_adasyn.py diff --git a/imblearn/over_sampling/random_over_sampler.py b/imblearn/over_sampling/_random_over_sampler.py similarity index 100% rename from imblearn/over_sampling/random_over_sampler.py rename to imblearn/over_sampling/_random_over_sampler.py diff --git a/imblearn/over_sampling/smote.py b/imblearn/over_sampling/_smote.py similarity index 100% rename from imblearn/over_sampling/smote.py rename to imblearn/over_sampling/_smote.py diff --git a/imblearn/under_sampling/__init__.py b/imblearn/under_sampling/__init__.py index 28df84eec..4324833e5 100644 --- a/imblearn/under_sampling/__init__.py +++ b/imblearn/under_sampling/__init__.py @@ -3,18 +3,18 @@ a dataset. """ -from .prototype_generation import ClusterCentroids +from ._prototype_generation import ClusterCentroids -from .prototype_selection import RandomUnderSampler -from .prototype_selection import TomekLinks -from .prototype_selection import NearMiss -from .prototype_selection import CondensedNearestNeighbour -from .prototype_selection import OneSidedSelection -from .prototype_selection import NeighbourhoodCleaningRule -from .prototype_selection import EditedNearestNeighbours -from .prototype_selection import RepeatedEditedNearestNeighbours -from .prototype_selection import AllKNN -from .prototype_selection import InstanceHardnessThreshold +from ._prototype_selection import RandomUnderSampler +from ._prototype_selection import TomekLinks +from ._prototype_selection import NearMiss +from ._prototype_selection import CondensedNearestNeighbour +from ._prototype_selection import OneSidedSelection +from ._prototype_selection import NeighbourhoodCleaningRule +from ._prototype_selection import EditedNearestNeighbours +from ._prototype_selection import RepeatedEditedNearestNeighbours +from ._prototype_selection import AllKNN +from ._prototype_selection import InstanceHardnessThreshold __all__ = [ 'ClusterCentroids', 'RandomUnderSampler', 'InstanceHardnessThreshold', diff --git a/imblearn/under_sampling/prototype_generation/__init__.py b/imblearn/under_sampling/_prototype_generation/__init__.py similarity index 78% rename from imblearn/under_sampling/prototype_generation/__init__.py rename to imblearn/under_sampling/_prototype_generation/__init__.py index 2052cdb2d..1bd6a8885 100644 --- a/imblearn/under_sampling/prototype_generation/__init__.py +++ b/imblearn/under_sampling/_prototype_generation/__init__.py @@ -3,6 +3,6 @@ methods that generate new samples in order to balance the dataset. """ -from .cluster_centroids import ClusterCentroids +from ._cluster_centroids import ClusterCentroids __all__ = ['ClusterCentroids'] diff --git a/imblearn/under_sampling/prototype_generation/cluster_centroids.py b/imblearn/under_sampling/_prototype_generation/_cluster_centroids.py similarity index 100% rename from imblearn/under_sampling/prototype_generation/cluster_centroids.py rename to imblearn/under_sampling/_prototype_generation/_cluster_centroids.py diff --git a/imblearn/under_sampling/prototype_generation/tests/__init__.py b/imblearn/under_sampling/_prototype_generation/tests/__init__.py similarity index 100% rename from imblearn/under_sampling/prototype_generation/tests/__init__.py rename to imblearn/under_sampling/_prototype_generation/tests/__init__.py diff --git a/imblearn/under_sampling/prototype_generation/tests/test_cluster_centroids.py b/imblearn/under_sampling/_prototype_generation/tests/test_cluster_centroids.py similarity index 100% rename from imblearn/under_sampling/prototype_generation/tests/test_cluster_centroids.py rename to imblearn/under_sampling/_prototype_generation/tests/test_cluster_centroids.py diff --git a/imblearn/under_sampling/_prototype_selection/__init__.py b/imblearn/under_sampling/_prototype_selection/__init__.py new file mode 100644 index 000000000..d721fbe49 --- /dev/null +++ b/imblearn/under_sampling/_prototype_selection/__init__.py @@ -0,0 +1,22 @@ +""" +The :mod:`imblearn.under_sampling.prototype_selection` submodule contains +methods that select samples in order to balance the dataset. +""" + +from ._random_under_sampler import RandomUnderSampler +from ._tomek_links import TomekLinks +from ._nearmiss import NearMiss +from ._condensed_nearest_neighbour import CondensedNearestNeighbour +from ._one_sided_selection import OneSidedSelection +from ._neighbourhood_cleaning_rule import NeighbourhoodCleaningRule +from ._edited_nearest_neighbours import EditedNearestNeighbours +from ._edited_nearest_neighbours import RepeatedEditedNearestNeighbours +from ._edited_nearest_neighbours import AllKNN +from ._instance_hardness_threshold import InstanceHardnessThreshold + +__all__ = [ + 'RandomUnderSampler', 'InstanceHardnessThreshold', 'NearMiss', + 'TomekLinks', 'EditedNearestNeighbours', 'RepeatedEditedNearestNeighbours', + 'AllKNN', 'OneSidedSelection', 'CondensedNearestNeighbour', + 'NeighbourhoodCleaningRule' +] diff --git a/imblearn/under_sampling/prototype_selection/condensed_nearest_neighbour.py b/imblearn/under_sampling/_prototype_selection/_condensed_nearest_neighbour.py similarity index 100% rename from imblearn/under_sampling/prototype_selection/condensed_nearest_neighbour.py rename to imblearn/under_sampling/_prototype_selection/_condensed_nearest_neighbour.py diff --git a/imblearn/under_sampling/prototype_selection/edited_nearest_neighbours.py b/imblearn/under_sampling/_prototype_selection/_edited_nearest_neighbours.py similarity index 100% rename from imblearn/under_sampling/prototype_selection/edited_nearest_neighbours.py rename to imblearn/under_sampling/_prototype_selection/_edited_nearest_neighbours.py diff --git a/imblearn/under_sampling/prototype_selection/instance_hardness_threshold.py b/imblearn/under_sampling/_prototype_selection/_instance_hardness_threshold.py similarity index 100% rename from imblearn/under_sampling/prototype_selection/instance_hardness_threshold.py rename to imblearn/under_sampling/_prototype_selection/_instance_hardness_threshold.py diff --git a/imblearn/under_sampling/prototype_selection/nearmiss.py b/imblearn/under_sampling/_prototype_selection/_nearmiss.py similarity index 100% rename from imblearn/under_sampling/prototype_selection/nearmiss.py rename to imblearn/under_sampling/_prototype_selection/_nearmiss.py diff --git a/imblearn/under_sampling/prototype_selection/neighbourhood_cleaning_rule.py b/imblearn/under_sampling/_prototype_selection/_neighbourhood_cleaning_rule.py similarity index 99% rename from imblearn/under_sampling/prototype_selection/neighbourhood_cleaning_rule.py rename to imblearn/under_sampling/_prototype_selection/_neighbourhood_cleaning_rule.py index 9ad955766..4bcb46b11 100644 --- a/imblearn/under_sampling/prototype_selection/neighbourhood_cleaning_rule.py +++ b/imblearn/under_sampling/_prototype_selection/_neighbourhood_cleaning_rule.py @@ -14,7 +14,7 @@ from sklearn.utils import safe_indexing from ..base import BaseCleaningSampler -from .edited_nearest_neighbours import EditedNearestNeighbours +from ._edited_nearest_neighbours import EditedNearestNeighbours from ...utils import check_neighbors_object from ...utils import Substitution from ...utils.deprecation import deprecate_parameter diff --git a/imblearn/under_sampling/prototype_selection/one_sided_selection.py b/imblearn/under_sampling/_prototype_selection/_one_sided_selection.py similarity index 99% rename from imblearn/under_sampling/prototype_selection/one_sided_selection.py rename to imblearn/under_sampling/_prototype_selection/_one_sided_selection.py index 4bf7341e9..046fa2a8e 100644 --- a/imblearn/under_sampling/prototype_selection/one_sided_selection.py +++ b/imblearn/under_sampling/_prototype_selection/_one_sided_selection.py @@ -15,7 +15,7 @@ from sklearn.utils import check_random_state, safe_indexing from ..base import BaseCleaningSampler -from .tomek_links import TomekLinks +from ._tomek_links import TomekLinks from ...utils import Substitution from ...utils._docstring import _random_state_docstring diff --git a/imblearn/under_sampling/prototype_selection/random_under_sampler.py b/imblearn/under_sampling/_prototype_selection/_random_under_sampler.py similarity index 100% rename from imblearn/under_sampling/prototype_selection/random_under_sampler.py rename to imblearn/under_sampling/_prototype_selection/_random_under_sampler.py diff --git a/imblearn/under_sampling/prototype_selection/tomek_links.py b/imblearn/under_sampling/_prototype_selection/_tomek_links.py similarity index 100% rename from imblearn/under_sampling/prototype_selection/tomek_links.py rename to imblearn/under_sampling/_prototype_selection/_tomek_links.py diff --git a/imblearn/under_sampling/prototype_selection/tests/__init__.py b/imblearn/under_sampling/_prototype_selection/tests/__init__.py similarity index 100% rename from imblearn/under_sampling/prototype_selection/tests/__init__.py rename to imblearn/under_sampling/_prototype_selection/tests/__init__.py diff --git a/imblearn/under_sampling/prototype_selection/tests/test_allknn.py b/imblearn/under_sampling/_prototype_selection/tests/test_allknn.py similarity index 100% rename from imblearn/under_sampling/prototype_selection/tests/test_allknn.py rename to imblearn/under_sampling/_prototype_selection/tests/test_allknn.py diff --git a/imblearn/under_sampling/prototype_selection/tests/test_condensed_nearest_neighbour.py b/imblearn/under_sampling/_prototype_selection/tests/test_condensed_nearest_neighbour.py similarity index 100% rename from imblearn/under_sampling/prototype_selection/tests/test_condensed_nearest_neighbour.py rename to imblearn/under_sampling/_prototype_selection/tests/test_condensed_nearest_neighbour.py diff --git a/imblearn/under_sampling/prototype_selection/tests/test_edited_nearest_neighbours.py b/imblearn/under_sampling/_prototype_selection/tests/test_edited_nearest_neighbours.py similarity index 100% rename from imblearn/under_sampling/prototype_selection/tests/test_edited_nearest_neighbours.py rename to imblearn/under_sampling/_prototype_selection/tests/test_edited_nearest_neighbours.py diff --git a/imblearn/under_sampling/prototype_selection/tests/test_instance_hardness_threshold.py b/imblearn/under_sampling/_prototype_selection/tests/test_instance_hardness_threshold.py similarity index 100% rename from imblearn/under_sampling/prototype_selection/tests/test_instance_hardness_threshold.py rename to imblearn/under_sampling/_prototype_selection/tests/test_instance_hardness_threshold.py diff --git a/imblearn/under_sampling/prototype_selection/tests/test_nearmiss.py b/imblearn/under_sampling/_prototype_selection/tests/test_nearmiss.py similarity index 100% rename from imblearn/under_sampling/prototype_selection/tests/test_nearmiss.py rename to imblearn/under_sampling/_prototype_selection/tests/test_nearmiss.py diff --git a/imblearn/under_sampling/prototype_selection/tests/test_neighbourhood_cleaning_rule.py b/imblearn/under_sampling/_prototype_selection/tests/test_neighbourhood_cleaning_rule.py similarity index 100% rename from imblearn/under_sampling/prototype_selection/tests/test_neighbourhood_cleaning_rule.py rename to imblearn/under_sampling/_prototype_selection/tests/test_neighbourhood_cleaning_rule.py diff --git a/imblearn/under_sampling/prototype_selection/tests/test_one_sided_selection.py b/imblearn/under_sampling/_prototype_selection/tests/test_one_sided_selection.py similarity index 100% rename from imblearn/under_sampling/prototype_selection/tests/test_one_sided_selection.py rename to imblearn/under_sampling/_prototype_selection/tests/test_one_sided_selection.py diff --git a/imblearn/under_sampling/prototype_selection/tests/test_random_under_sampler.py b/imblearn/under_sampling/_prototype_selection/tests/test_random_under_sampler.py similarity index 100% rename from imblearn/under_sampling/prototype_selection/tests/test_random_under_sampler.py rename to imblearn/under_sampling/_prototype_selection/tests/test_random_under_sampler.py diff --git a/imblearn/under_sampling/prototype_selection/tests/test_repeated_edited_nearest_neighbours.py b/imblearn/under_sampling/_prototype_selection/tests/test_repeated_edited_nearest_neighbours.py similarity index 100% rename from imblearn/under_sampling/prototype_selection/tests/test_repeated_edited_nearest_neighbours.py rename to imblearn/under_sampling/_prototype_selection/tests/test_repeated_edited_nearest_neighbours.py diff --git a/imblearn/under_sampling/prototype_selection/tests/test_tomek_links.py b/imblearn/under_sampling/_prototype_selection/tests/test_tomek_links.py similarity index 100% rename from imblearn/under_sampling/prototype_selection/tests/test_tomek_links.py rename to imblearn/under_sampling/_prototype_selection/tests/test_tomek_links.py diff --git a/imblearn/under_sampling/prototype_selection/__init__.py b/imblearn/under_sampling/prototype_selection/__init__.py deleted file mode 100644 index 40e6a43df..000000000 --- a/imblearn/under_sampling/prototype_selection/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -""" -The :mod:`imblearn.under_sampling.prototype_selection` submodule contains -methods that select samples in order to balance the dataset. -""" - -from .random_under_sampler import RandomUnderSampler -from .tomek_links import TomekLinks -from .nearmiss import NearMiss -from .condensed_nearest_neighbour import CondensedNearestNeighbour -from .one_sided_selection import OneSidedSelection -from .neighbourhood_cleaning_rule import NeighbourhoodCleaningRule -from .edited_nearest_neighbours import EditedNearestNeighbours -from .edited_nearest_neighbours import RepeatedEditedNearestNeighbours -from .edited_nearest_neighbours import AllKNN -from .instance_hardness_threshold import InstanceHardnessThreshold - -__all__ = [ - 'RandomUnderSampler', 'InstanceHardnessThreshold', 'NearMiss', - 'TomekLinks', 'EditedNearestNeighbours', 'RepeatedEditedNearestNeighbours', - 'AllKNN', 'OneSidedSelection', 'CondensedNearestNeighbour', - 'NeighbourhoodCleaningRule' -] diff --git a/imblearn/utils/__init__.py b/imblearn/utils/__init__.py index a3be9ffa0..eda8af1f9 100644 --- a/imblearn/utils/__init__.py +++ b/imblearn/utils/__init__.py @@ -4,11 +4,11 @@ from ._docstring import Substitution -from .validation import check_neighbors_object -from .validation import check_target_type -from .validation import hash_X_y -from .validation import check_ratio -from .validation import check_sampling_strategy +from ._validation import check_neighbors_object +from ._validation import check_target_type +from ._validation import hash_X_y +from ._validation import check_ratio +from ._validation import check_sampling_strategy __all__ = [ 'Substitution', 'check_neighbors_object', 'check_target_type', 'hash_X_y', diff --git a/imblearn/utils/validation.py b/imblearn/utils/_validation.py similarity index 100% rename from imblearn/utils/validation.py rename to imblearn/utils/_validation.py