Skip to content

Commit c0a4208

Browse files
authored
MAINT: bump the version of scikit-learn 0.20rc1
1 parent fe51ca3 commit c0a4208

26 files changed

+207
-288
lines changed

Diff for: .travis.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ matrix:
3333
- env: DISTRIB="ubuntu"
3434
# Latest release
3535
- env: DISTRIB="conda" PYTHON_VERSION="2.7"
36-
NUMPY_VERSION="1.13.1" SCIPY_VERSION="0.19.1" SKLEARN_VERSION="0.19.0"
37-
- env: DISTRIB="conda" PYTHON_VERSION="3.5"
38-
NUMPY_VERSION="1.13.1" SCIPY_VERSION="0.19.1" SKLEARN_VERSION="0.19.0"
36+
NUMPY_VERSION="1.13.1" SCIPY_VERSION="0.19.1" SKLEARN_VERSION="0.20rc"
3937
- env: DISTRIB="conda" PYTHON_VERSION="3.6"
40-
NUMPY_VERSION="1.13.1" SCIPY_VERSION="0.19.1" SKLEARN_VERSION="0.19.0"
38+
NUMPY_VERSION="1.13.1" SCIPY_VERSION="0.19.1" SKLEARN_VERSION="0.20rc"
39+
- env: DISTRIB="conda" PYTHON_VERSION="3.7"
40+
NUMPY_VERSION="1.13.1" SCIPY_VERSION="0.19.1" SKLEARN_VERSION="0.20rc"
4141
- env: DISTRIB="conda" PYTHON_VERSION="3.7"
4242
NUMPY_VERSION="*" SCIPY_VERSION="*" SKLEARN_VERSION="master"
4343
allow_failures:

Diff for: CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ tools:
9898

9999
- Code with good unittest coverage (at least 80%), check with:
100100

101-
$ pip install nose coverage
102-
$ nosetests --with-coverage path/to/tests_for_package
101+
$ pip install pytest pytest-cov
102+
$ pytest --cov=imblearn imblearn
103103

104104
- No pyflakes warnings, check with:
105105

Diff for: Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ clean:
1313
rm -rf examples/.ipynb_checkpoints
1414

1515
test-code:
16-
py.test imblearn
16+
pytest imblearn
1717

1818
test-doc:
19-
py.test doc/*.rst
19+
pytest doc/*.rst
2020

2121
test-coverage:
2222
rm -rf coverage .coverage
23-
py.test --cov=imblearn imblearn
23+
pytest --cov=imblearn imblearn
2424

2525
test: test-coverage test-doc
2626

Diff for: README.rst

+6-4
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,20 @@ Installation
4949
Dependencies
5050
~~~~~~~~~~~~
5151

52-
imbalanced-learn is tested to work under Python 2.7 and Python 3.5, and
53-
3.6. The dependency requirements are based on the last scikit-learn release:
52+
imbalanced-learn is tested to work under Python 2.7 and Python 3.6, and
53+
3.7. The dependency requirements are based on the last scikit-learn release:
5454

5555
* scipy(>=0.13.3)
5656
* numpy(>=1.8.2)
57-
* scikit-learn(>=0.19.0)
57+
* scikit-learn(>=0.20)
5858
* keras 2 (optional)
5959
* tensorflow (optional)
6060

6161
Additionally, to run the examples, you need matplotlib(>=2.0.0) and
6262
pandas(>=0.22).
6363

64+
**imbalanced-learn 0.4 is the last version to support Python 2.7**
65+
6466
Installation
6567
~~~~~~~~~~~~
6668

@@ -87,7 +89,7 @@ Or install using pip and GitHub::
8789
Testing
8890
~~~~~~~
8991

90-
After installation, you can use `nose` to run the test suite::
92+
After installation, you can use `pytest` to run the test suite::
9193

9294
make coverage
9395

Diff for: appveyor.yml

+12-9
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,27 @@ environment:
88
# We use miniconda versions of Python provided by appveyor windows images
99
matrix:
1010
- PYTHON: "C:\\Miniconda-x64"
11-
PYTHON_VERSION: "2.7.x"
11+
PYTHON_VERSION: "2.7"
1212
PYTHON_ARCH: "64"
1313
OPTIONAL_DEP: "pandas"
1414

1515
- PYTHON: "C:\\Miniconda"
16-
PYTHON_VERSION: "2.7.x"
16+
PYTHON_VERSION: "2.7"
1717
PYTHON_ARCH: "32"
1818
OPTIONAL_DEP: "pandas"
1919

20-
- PYTHON: "C:\\Miniconda35-x64"
21-
PYTHON_VERSION: "3.5.x"
20+
- PYTHON: "C:\\Miniconda36-x64"
21+
PYTHON_VERSION: "3.6"
2222
PYTHON_ARCH: "64"
2323
OPTIONAL_DEP: "pandas keras tensorflow"
2424

2525
- PYTHON: "C:\\Miniconda36-x64"
26-
PYTHON_VERSION: "3.6.x"
26+
PYTHON_VERSION: "3.7"
2727
PYTHON_ARCH: "64"
28-
OPTIONAL_DEP: "pandas keras tensorflow"
28+
OPTIONAL_DEP: "pandas"
2929

3030
- PYTHON: "C:\\Miniconda36"
31-
PYTHON_VERSION: "3.6.x"
31+
PYTHON_VERSION: "3.7"
3232
PYTHON_ARCH: "32"
3333
OPTIONAL_DEP: "pandas"
3434

@@ -37,11 +37,14 @@ install:
3737
# Add Library/bin directory to fix issue
3838
# https://github.com/conda/conda/issues/1753
3939
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PYTHON%\\Library\\bin;%PATH%"
40-
- conda install pip scipy numpy scikit-learn=0.19 -y -q
40+
- conda update conda -y -q
41+
- conda create -n testenv --yes python=%PYTHON_VERSION% pip
42+
- activate testenv
43+
- conda install scipy numpy -y -q
44+
- pip install --pre scikit-learn
4145
- "conda install %OPTIONAL_DEP% -y -q"
4246
- conda install pytest pytest-cov -y -q
4347
- pip install codecov
44-
- conda install nose -y -q # FIXME: remove this line when using sklearn > 0.19
4548
- pip install .
4649

4750
test_script:

Diff for: build_tools/circle/build_doc.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ conda create -n $CONDA_ENV_NAME --yes --quiet python=3
9292
source activate $CONDA_ENV_NAME
9393

9494
conda install --yes pip numpy scipy scikit-learn pillow matplotlib sphinx \
95-
sphinx_rtd_theme numpydoc pandas keras nose
95+
sphinx_rtd_theme numpydoc pandas keras
9696
pip install -U git+https://github.com/sphinx-gallery/sphinx-gallery.git
9797

9898
# Build and install imbalanced-learn in dev mode

Diff for: build_tools/travis/after_success.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
set -e
88

99
# Need to run covdecov from a git checkout, so we copy .coverage
10-
# from TEST_DIR where nosetests has been run
10+
# from TEST_DIR where pytest has been run
1111
cd $TRAVIS_BUILD_DIR
1212
# Ignore covdecov failures as the covdecov server is not
1313
# very reliable but we don't want travis to report a failure

Diff for: build_tools/travis/install.sh

+7-7
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ if [[ "$DISTRIB" == "conda" ]]; then
4040
source activate testenv
4141
conda install --yes numpy=$NUMPY_VERSION scipy=$SCIPY_VERSION
4242

43-
if [[ $PYTHON_VERSION == "3.6" ]]; then
43+
if [[ $PYTHON_VERSION == "3.7" ]]; then
4444
conda install --yes pandas
4545
conda install --yes -c conda-forge keras
4646
KERAS_BACKEND=tensorflow
@@ -52,12 +52,11 @@ if [[ "$DISTRIB" == "conda" ]]; then
5252
conda install --yes cython
5353
pip install -U git+https://github.com/scikit-learn/scikit-learn.git
5454
else
55-
conda install --yes scikit-learn=$SKLEARN_VERSION
55+
conda install --yes scikit-learn=$SKLEARN_VERSION -c conda-forge/label/rc -c conda-forge
5656
fi
5757

58-
conda install --yes nose pytest pytest-cov
59-
# Install nose-timer via pip
60-
pip install nose-timer codecov
58+
conda install --yes pytest pytest-cov
59+
pip install codecov
6160

6261
elif [[ "$DISTRIB" == "ubuntu" ]]; then
6362
# At the time of writing numpy 1.9.1 is included in the travis
@@ -67,9 +66,10 @@ elif [[ "$DISTRIB" == "ubuntu" ]]; then
6766
# Create a new virtualenv using system site packages for python, numpy
6867
virtualenv --system-site-packages testvenv
6968
source testvenv/bin/activate
70-
pip install scikit-learn
69+
70+
pip install --pre scikit-learn
7171
pip install pandas keras tensorflow
72-
pip install nose nose-timer pytest pytest-cov codecov sphinx numpydoc
72+
pip install pytest pytest-cov codecov sphinx numpydoc
7373

7474
fi
7575

Diff for: build_tools/travis/test_script.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ run_tests(){
1212
# Get into a temp directory to run test from the installed scikit learn and
1313
# check if we do not leave artifacts
1414
mkdir -p $TEST_DIR
15-
# We need the setup.cfg for the nose settings
15+
# We need the setup.cfg for the pytest settings
1616
cp setup.cfg $TEST_DIR
1717
cd $TEST_DIR
1818

@@ -21,7 +21,7 @@ run_tests(){
2121
python -c "import scipy; print('scipy %s' % scipy.__version__)"
2222
python -c "import multiprocessing as mp; print('%d CPUs' % mp.cpu_count())"
2323

24-
py.test --cov=$MODULE -r sx --pyargs $MODULE
24+
pytest --cov=$MODULE -r sx --pyargs $MODULE
2525

2626
# Test doc
2727
cd $OLDPWD

Diff for: doc/install.rst

+7-2
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@ The imbalanced-learn package requires the following dependencies:
99

1010
* numpy (>=1.8.2)
1111
* scipy (>=0.13.3)
12-
* scikit-learn (>=0.19.0)
12+
* scikit-learn (>=0.20)
1313
* keras 2 (optional)
1414
* tensorflow (optional)
1515

1616
Our release policy is to follow the scikit-learn releases in order to
17-
synchronize the new feature.
17+
synchronize the new feature. **imbalanced-learn 0.4 is the last version to
18+
support Python 2.7**
1819

1920
Install
2021
=======
@@ -50,6 +51,10 @@ You wish to test the coverage of your version::
5051

5152
$ make coverage
5253

54+
You can also use `pytest`::
55+
56+
$ pytest imblearn -v
57+
5358
Contribute
5459
==========
5560

Diff for: doc/whats_new/v0.0.4.rst

+4-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Bug fixes
8181
samples.
8282
:issue:`450` by :user:`Guillaume Lemaitre <glemaitre>`.
8383

84-
- Add the option to pass a ``Memory`` object to :func:`make_pipeline` like
84+
- Add the option to pass a ``Memory`` object to :func:`make_pipeline` like
8585
in :class:`pipeline.Pipeline` class.
8686
:issue:`458` by :user:`Christos Aridas <chkoar>`.
8787

@@ -94,6 +94,9 @@ Maintenance
9494
- Make some modules private.
9595
:issue:`452` by :user:`Guillaume Lemaitre <glemaitre>`.
9696

97+
- Upgrade requirements to scikit-learn 0.20.
98+
:issue:`379` by :user:`Guillaume Lemaitre <glemaitre>`.
99+
97100
Documentation
98101
.............
99102

Diff for: imblearn/base.py

-15
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
from __future__ import division
88

9-
import logging
109
import warnings
1110
from abc import ABCMeta, abstractmethod
1211

@@ -132,7 +131,6 @@ def __init__(self, sampling_strategy='auto', ratio=None):
132131
self.sampling_strategy = sampling_strategy
133132
# FIXME: remove in 0.6
134133
self.ratio = ratio
135-
self.logger = logging.getLogger(self.__module__)
136134

137135
@staticmethod
138136
def _check_X_y(X, y):
@@ -154,18 +152,6 @@ def _deprecate_ratio(self):
154152
deprecate_parameter(self, '0.4', 'ratio', 'sampling_strategy')
155153
self.sampling_strategy = self.ratio
156154

157-
def __getstate__(self):
158-
"""Prevent logger from being pickled."""
159-
object_dictionary = self.__dict__.copy()
160-
del object_dictionary['logger']
161-
return object_dictionary
162-
163-
def __setstate__(self, dict):
164-
"""Re-open the logger."""
165-
logger = logging.getLogger(self.__module__)
166-
self.__dict__.update(dict)
167-
self.logger = logger
168-
169155

170156
def _identity(X, y):
171157
return X, y
@@ -241,7 +227,6 @@ def __init__(self, func=None, accept_sparse=True, kw_args=None):
241227
self.func = func
242228
self.accept_sparse = accept_sparse
243229
self.kw_args = kw_args
244-
self.logger = logging.getLogger(__name__)
245230

246231
def _fit_resample(self, X, y):
247232
X, y = check_X_y(X, y, accept_sparse=['csr', 'csc']

Diff for: imblearn/combine/_smote_enn.py

-3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
from __future__ import division
88

9-
import logging
10-
119
from sklearn.base import clone
1210
from sklearn.utils import check_X_y
1311

@@ -98,7 +96,6 @@ def __init__(self,
9896
self.smote = smote
9997
self.enn = enn
10098
self.ratio = ratio
101-
self.logger = logging.getLogger(__name__)
10299

103100
def _validate_estimator(self):
104101
"Private function to validate SMOTE and ENN objects"

Diff for: imblearn/combine/_smote_tomek.py

-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
from __future__ import division
99

10-
import logging
11-
1210
from sklearn.base import clone
1311
from sklearn.utils import check_X_y
1412

@@ -106,7 +104,6 @@ def __init__(self,
106104
self.smote = smote
107105
self.tomek = tomek
108106
self.ratio = ratio
109-
self.logger = logging.getLogger(__name__)
110107

111108
def _validate_estimator(self):
112109
"Private function to validate SMOTE and ENN objects"

Diff for: imblearn/datasets/_imbalance.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
# Christos Aridas
66
# License: MIT
77

8-
import logging
98
import warnings
109
from collections import Counter
1110

@@ -14,14 +13,13 @@
1413
from ..under_sampling import RandomUnderSampler
1514
from ..utils import check_sampling_strategy
1615

17-
LOGGER = logging.getLogger(__name__)
18-
1916

2017
def make_imbalance(X,
2118
y,
2219
sampling_strategy=None,
2320
ratio=None,
2421
random_state=None,
22+
verbose=False,
2523
**kwargs):
2624
"""Turns a dataset into an imbalanced dataset at specific ratio.
2725
@@ -60,6 +58,9 @@ def make_imbalance(X,
6058
If None, the random number generator is the RandomState instance used
6159
by np.random.
6260
61+
verbose : bool, optional (default=False)
62+
Show information regarding the sampling.
63+
6364
kwargs : dict, optional
6465
Dictionary of additional keyword arguments to pass to
6566
``sampling_strategy``.
@@ -115,13 +116,15 @@ def make_imbalance(X,
115116
"function returning a dictionary. Got {} instead."
116117
.format(type(sampling_strategy)))
117118

118-
LOGGER.info('The original target distribution in the dataset is: %s',
119-
target_stats)
119+
if verbose:
120+
print('The original target distribution in the dataset is: %s',
121+
target_stats)
120122
rus = RandomUnderSampler(
121123
sampling_strategy=sampling_strategy_,
122124
replacement=False,
123125
random_state=random_state)
124126
X_resampled, y_resampled = rus.fit_resample(X, y)
125-
LOGGER.info('Make the dataset imbalanced: %s', Counter(y_resampled))
127+
if verbose:
128+
print('Make the dataset imbalanced: %s', Counter(y_resampled))
126129

127130
return X_resampled, y_resampled

0 commit comments

Comments
 (0)