From 1a9a1b815143fa3782724fcfdde7f78ee7d438e5 Mon Sep 17 00:00:00 2001 From: Guillaume Lemaitre Date: Wed, 29 Jun 2016 19:35:16 +0200 Subject: [PATCH] PEP8 --- imblearn/ensemble/balance_cascade.py | 4 ++-- imblearn/pipeline.py | 2 +- imblearn/tests/test_pipeline.py | 1 + .../under_sampling/tests/test_instance_hardness_threshold.py | 2 +- imblearn/under_sampling/tests/test_nearmiss_3.py | 1 + 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/imblearn/ensemble/balance_cascade.py b/imblearn/ensemble/balance_cascade.py index 3c6aba279..8dfa5789d 100644 --- a/imblearn/ensemble/balance_cascade.py +++ b/imblearn/ensemble/balance_cascade.py @@ -195,8 +195,8 @@ def _sample(self, X, y): # from the majority class depending of the false classification # rate of the previous iteration idx_sel_from_maj = random_state.choice(np.nonzero(b_sel_N)[0], - size=num_samples, - replace=False) + size=num_samples, + replace=False) idx_sel_from_maj = np.concatenate((idx_mis_class, idx_sel_from_maj), axis=0).astype(int) diff --git a/imblearn/pipeline.py b/imblearn/pipeline.py index 93ef8f4b0..9e7e3e574 100644 --- a/imblearn/pipeline.py +++ b/imblearn/pipeline.py @@ -70,7 +70,7 @@ def __init__(self, steps): for t in transforms: if (not (hasattr(t, "fit") or hasattr(t, "fit_transform") or hasattr(t, "fit_sample")) or - not (hasattr(t, "transform") or hasattr(t, "sample"))): + not (hasattr(t, "transform") or hasattr(t, "sample"))): raise TypeError("All intermediate steps of the chain should " "be transforms and implement fit and transform" " '%s' (type %s) doesn't)" % (t, type(t))) diff --git a/imblearn/tests/test_pipeline.py b/imblearn/tests/test_pipeline.py index bbc2e156d..8f67d6d13 100644 --- a/imblearn/tests/test_pipeline.py +++ b/imblearn/tests/test_pipeline.py @@ -424,6 +424,7 @@ def test_pipeline_sample_transform(): pipeline.fit(X, y).transform(X) + def test_pipeline_methods_anova_rus(): # Test the various methods of the pipeline (anova). X, y = make_classification(n_classes=2, class_sep=2, weights=[0.1, 0.9], diff --git a/imblearn/under_sampling/tests/test_instance_hardness_threshold.py b/imblearn/under_sampling/tests/test_instance_hardness_threshold.py index d538f63a5..354db975a 100644 --- a/imblearn/under_sampling/tests/test_instance_hardness_threshold.py +++ b/imblearn/under_sampling/tests/test_instance_hardness_threshold.py @@ -64,6 +64,7 @@ def test_iht_wrong_estimator(): random_state=RND_SEED) assert_raises(NotImplementedError, iht.fit_sample, X, Y) + def test_iht_init(): """Test the initialisation of the object""" @@ -233,7 +234,6 @@ def test_iht_fit_sample_adaboost(): assert_array_equal(y_resampled, y_gt) - def test_iht_fit_sample_gradient_boosting(): """Test the fit sample routine with gradient boosting""" diff --git a/imblearn/under_sampling/tests/test_nearmiss_3.py b/imblearn/under_sampling/tests/test_nearmiss_3.py index 628190a92..3b62b1eec 100644 --- a/imblearn/under_sampling/tests/test_nearmiss_3.py +++ b/imblearn/under_sampling/tests/test_nearmiss_3.py @@ -60,6 +60,7 @@ def test_nearmiss_wrong_version(): nm3 = NearMiss(version=version, random_state=RND_SEED) assert_raises(ValueError, nm3.fit_sample, X, Y) + def test_nearmiss_init(): """Test the initialisation of the object"""