Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
15 changes: 6 additions & 9 deletions build_tools/travis/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion imblearn/combine/smote_enn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
----------
Expand Down
3 changes: 1 addition & 2 deletions imblearn/ensemble/balance_cascade.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions imblearn/metrics/tests/test_score_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion imblearn/over_sampling/adasyn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
----------
Expand Down
6 changes: 3 additions & 3 deletions imblearn/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ class Pipeline(pipeline.Pipeline):
>>> print(classification_report(y_test, y_hat))
precision recall f1-score support
<BLANKLINE>
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
<BLANKLINE>
avg / total 0.97 0.96 0.96 250
avg / total 0.99 0.98 0.98 250
<BLANKLINE>

"""
Expand Down
6 changes: 3 additions & 3 deletions imblearn/under_sampling/edited_nearest_neighbours.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
----------
Expand Down Expand Up @@ -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
----------
Expand Down Expand Up @@ -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
----------
Expand Down
9 changes: 4 additions & 5 deletions imblearn/under_sampling/instance_hardness_threshold.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
----------
Expand Down
2 changes: 1 addition & 1 deletion imblearn/under_sampling/neighbourhood_cleaning_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
----------
Expand Down
2 changes: 1 addition & 1 deletion imblearn/under_sampling/one_sided_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
----------
Expand Down