diff --git a/.travis.yml b/.travis.yml index 4567b167d..9c70cc38b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,13 +29,13 @@ env: matrix: # This environment tests the using anaconda - DISTRIB="conda" PYTHON_VERSION="2.7" COVERAGE="true" - NUMPY_VERSION="1.9.3" SCIPY_VERSION="0.16.0" + NUMPY_VERSION="1.11.2" SCIPY_VERSION="0.18.1" SKLEARN_VERSION="0.18.1" - DISTRIB="conda" PYTHON_VERSION="3.5" COVERAGE="true" - NUMPY_VERSION="1.10.4" SCIPY_VERSION="0.17.0" + NUMPY_VERSION="1.11.2" SCIPY_VERSION="0.18.1" SKLEARN_VERSION="0.18.1" # flake8 linting on diff wrt common ancestor with upstream/master - RUN_FLAKE8="true" SKIP_TESTS="true" DISTRIB="conda" PYTHON_VERSION="3.5" - NUMPY_VERSION="1.10.4" SCIPY_VERSION="0.17.0" + NUMPY_VERSION="1.11.2" SCIPY_VERSION="0.18.1" SKLEARN_VERSION="0.18.1" install: source build_tools/travis/install.sh script: bash build_tools/travis/test_script.sh diff --git a/appveyor.yml b/appveyor.yml index 51f4d1563..29a855532 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -24,7 +24,7 @@ install: - "python -c \"import struct; print(struct.calcsize('P') * 8)\"" # Installed prebuilt dependencies from conda - - "conda install pip numpy scipy scikit-learn nose wheel matplotlib -y -q" + - "conda install pip numpy=1.11.2 scipy=0.18.1 scikit-learn=0.18.1 nose wheel matplotlib -y -q" # Install other nilearn dependencies - "pip install coverage nose-timer" diff --git a/build_tools/travis/install.sh b/build_tools/travis/install.sh index 938d703f4..a6667fcc0 100644 --- a/build_tools/travis/install.sh +++ b/build_tools/travis/install.sh @@ -24,20 +24,17 @@ popd # Configure the conda environment and put it in the path using the # provided versions -conda create -n testenv --yes python=$PYTHON_VERSION pip nose \ +conda create -n testenv --yes python=$PYTHON_VERSION pip nose numpy=$NUMPY_VERSION scipy=$SCIPY_VERSION \ - libgfortran nomkl flake8 -#source activate testenv + libgfortran nomkl +source activate testenv + +# Install scikit-learn +conda install --yes scikit-learn=$SKLEARN_VERSION # Install nose-timer via pip pip install nose-timer -# Install libgfortran with conda -conda install --yes libgfortran \ - numpy=1.10.4 scipy=0.17.1 \ - scikit-learn=0.17.1 \ - six=1.10.0 - if [[ "$COVERAGE" == "true" ]]; then pip install coverage coveralls fi diff --git a/imblearn/combine/smote_enn.py b/imblearn/combine/smote_enn.py index c48c8970c..f3e526106 100644 --- a/imblearn/combine/smote_enn.py +++ b/imblearn/combine/smote_enn.py @@ -128,7 +128,7 @@ class SMOTEENN(BaseBinarySampler): >>> sme = SMOTEENN(random_state=42) >>> X_res, y_res = sme.fit_sample(X, y) >>> print('Resampled dataset shape {}'.format(Counter(y_res))) - Resampled dataset shape Counter({0: 900, 1: 865}) + Resampled dataset shape Counter({0: 900, 1: 881}) References ---------- diff --git a/imblearn/ensemble/balance_cascade.py b/imblearn/ensemble/balance_cascade.py index edc33574f..14d70a302 100644 --- a/imblearn/ensemble/balance_cascade.py +++ b/imblearn/ensemble/balance_cascade.py @@ -9,8 +9,7 @@ from sklearn.neighbors import KNeighborsClassifier from sklearn.utils import check_random_state from sklearn.utils.validation import has_fit_parameter - -from six import string_types +from sklearn.externals.six import string_types from ..base import BaseBinarySampler diff --git a/imblearn/metrics/tests/test_score_objects.py b/imblearn/metrics/tests/test_score_objects.py index 65a28cc98..608beed4b 100644 --- a/imblearn/metrics/tests/test_score_objects.py +++ b/imblearn/metrics/tests/test_score_objects.py @@ -10,8 +10,8 @@ geometric_mean_score, make_index_balanced_accuracy) # Get the version -(major, minor, _) = sklearn.__version__.split('.') -if int(minor) < 18: +sk_version = sklearn.__version__ +if sk_version < '0.18': from sklearn.cross_validation import train_test_split from sklearn.grid_search import GridSearchCV else: diff --git a/imblearn/over_sampling/adasyn.py b/imblearn/over_sampling/adasyn.py index 833d7a1eb..72f62dfd5 100644 --- a/imblearn/over_sampling/adasyn.py +++ b/imblearn/over_sampling/adasyn.py @@ -84,7 +84,7 @@ class ADASYN(BaseBinarySampler): >>> ada = ADASYN(random_state=42) >>> X_res, y_res = ada.fit_sample(X, y) >>> print('Resampled dataset shape {}'.format(Counter(y_res))) - Resampled dataset shape Counter({0: 909, 1: 900}) + Resampled dataset shape Counter({0: 904, 1: 900}) References ---------- diff --git a/imblearn/pipeline.py b/imblearn/pipeline.py index 303a7c7a1..a13d0d237 100644 --- a/imblearn/pipeline.py +++ b/imblearn/pipeline.py @@ -103,10 +103,10 @@ class Pipeline(pipeline.Pipeline): >>> print(classification_report(y_test, y_hat)) precision recall f1-score support - 0 0.71 1.00 0.83 24 - 1 1.00 0.96 0.98 226 + 0 0.87 1.00 0.93 26 + 1 1.00 0.98 0.99 224 - avg / total 0.97 0.96 0.96 250 + avg / total 0.99 0.98 0.98 250 """ diff --git a/imblearn/under_sampling/edited_nearest_neighbours.py b/imblearn/under_sampling/edited_nearest_neighbours.py index 244469a91..9c450b4ff 100644 --- a/imblearn/under_sampling/edited_nearest_neighbours.py +++ b/imblearn/under_sampling/edited_nearest_neighbours.py @@ -91,7 +91,7 @@ class EditedNearestNeighbours(BaseMulticlassSampler): >>> enn = EditedNearestNeighbours(random_state=42) >>> X_res, y_res = enn.fit_sample(X, y) >>> print('Resampled dataset shape {}'.format(Counter(y_res))) - Resampled dataset shape Counter({1: 883, 0: 100}) + Resampled dataset shape Counter({1: 887, 0: 100}) References ---------- @@ -331,7 +331,7 @@ class RepeatedEditedNearestNeighbours(BaseMulticlassSampler): >>> renn = RepeatedEditedNearestNeighbours(random_state=42) >>> X_res, y_res = renn.fit_sample(X, y) >>> print('Resampled dataset shape {}'.format(Counter(y_res))) - Resampled dataset shape Counter({1: 883, 0: 100}) + Resampled dataset shape Counter({1: 887, 0: 100}) References ---------- @@ -576,7 +576,7 @@ class AllKNN(BaseMulticlassSampler): >>> allknn = AllKNN(random_state=42) >>> X_res, y_res = allknn.fit_sample(X, y) >>> print('Resampled dataset shape {}'.format(Counter(y_res))) - Resampled dataset shape Counter({1: 883, 0: 100}) + Resampled dataset shape Counter({1: 887, 0: 100}) References ---------- diff --git a/imblearn/under_sampling/instance_hardness_threshold.py b/imblearn/under_sampling/instance_hardness_threshold.py index 5d53c1285..91a9074a4 100644 --- a/imblearn/under_sampling/instance_hardness_threshold.py +++ b/imblearn/under_sampling/instance_hardness_threshold.py @@ -103,17 +103,16 @@ class InstanceHardnessThreshold(BaseBinarySampler): >>> from collections import Counter >>> from sklearn.datasets import make_classification - >>> from imblearn.under_sampling import \ - RepeatedEditedNearestNeighbours # doctest: +NORMALIZE_WHITESPACE + >>> from imblearn.under_sampling import InstanceHardnessThreshold >>> X, y = make_classification(n_classes=2, class_sep=2, ... weights=[0.1, 0.9], n_informative=3, n_redundant=1, flip_y=0, ... n_features=20, n_clusters_per_class=1, n_samples=1000, random_state=10) >>> print('Original dataset shape {}'.format(Counter(y))) Original dataset shape Counter({1: 900, 0: 100}) - >>> renn = RepeatedEditedNearestNeighbours(random_state=42) - >>> X_res, y_res = renn.fit_sample(X, y) + >>> iht = InstanceHardnessThreshold(random_state=42) + >>> X_res, y_res = iht.fit_sample(X, y) >>> print('Resampled dataset shape {}'.format(Counter(y_res))) - Resampled dataset shape Counter({1: 883, 0: 100}) + Resampled dataset shape Counter({1: 840, 0: 100}) References ---------- diff --git a/imblearn/under_sampling/neighbourhood_cleaning_rule.py b/imblearn/under_sampling/neighbourhood_cleaning_rule.py index 843813aff..1a725b851 100644 --- a/imblearn/under_sampling/neighbourhood_cleaning_rule.py +++ b/imblearn/under_sampling/neighbourhood_cleaning_rule.py @@ -77,7 +77,7 @@ class NeighbourhoodCleaningRule(BaseMulticlassSampler): >>> ncr = NeighbourhoodCleaningRule(random_state=42) >>> X_res, y_res = ncr.fit_sample(X, y) >>> print('Resampled dataset shape {}'.format(Counter(y_res))) - Resampled dataset shape Counter({1: 884, 0: 100}) + Resampled dataset shape Counter({1: 891, 0: 100}) References ---------- diff --git a/imblearn/under_sampling/one_sided_selection.py b/imblearn/under_sampling/one_sided_selection.py index 55dd1266c..e8303620e 100644 --- a/imblearn/under_sampling/one_sided_selection.py +++ b/imblearn/under_sampling/one_sided_selection.py @@ -82,7 +82,7 @@ class OneSidedSelection(BaseBinarySampler): >>> oss = OneSidedSelection(random_state=42) >>> X_res, y_res = oss.fit_sample(X, y) >>> print('Resampled dataset shape {}'.format(Counter(y_res))) - Resampled dataset shape Counter({1: 595, 0: 100}) + Resampled dataset shape Counter({1: 496, 0: 100}) References ----------