Skip to content

Commit 7032dcb

Browse files
authored
MAINT remove deprecated and synchronize with scikit-learn master (#617)
1 parent bbe3820 commit 7032dcb

File tree

101 files changed

+5182
-4966
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+5182
-4966
lines changed

.readthedocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ formats:
44
- none
55
requirements_file: requirements.txt
66
python:
7-
version: 3.6
7+
version: 3.7
88
pip_install: true
99
extra_requirements:
1010
- tests

.travis.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# make it explicit that we favor the new container-based travis workers
2-
dist: xenial
2+
dist: bionic
33
sudo: false
44

55
language: python
@@ -32,16 +32,12 @@ matrix:
3232
# Ubuntu 14.04 environment
3333
- env: DISTRIB="ubuntu"
3434
# Latest release
35-
- env: DISTRIB="conda" PYTHON_VERSION="3.6"
36-
NUMPY_VERSION="*" SCIPY_VERSION="*" SKLEARN_VERSION="0.21.2"
37-
OPTIONAL_DEPS="true"
3835
- env: DISTRIB="conda" PYTHON_VERSION="3.7"
39-
NUMPY_VERSION="*" SCIPY_VERSION="*" SKLEARN_VERSION="0.21.2"
40-
OPTIONAL_DEPS="false"
36+
NUMPY_VERSION="*" SCIPY_VERSION="*" SKLEARN_VERSION="master"
37+
OPTIONAL_DEPS="keras"
4138
- env: DISTRIB="conda" PYTHON_VERSION="3.7"
4239
NUMPY_VERSION="*" SCIPY_VERSION="*" SKLEARN_VERSION="master"
43-
OPTIONAL_DEPS="false"
44-
allow_failures:
40+
OPTIONAL_DEPS="tensorflow"
4541
- env: DISTRIB="conda" PYTHON_VERSION="3.7"
4642
NUMPY_VERSION="*" SCIPY_VERSION="*" SKLEARN_VERSION="master"
4743
OPTIONAL_DEPS="false"

README.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,9 @@ Below is a list of the methods currently implemented in this module.
162162
2. SMOTE + ENN [11]_
163163

164164
* Ensemble classifier using samplers internally
165-
1. EasyEnsemble [13]_
166-
2. BalanceCascade [13]_
167-
3. Balanced Random Forest [16]_
168-
4. Balanced Bagging
165+
1. Easy Ensemble classifier [13]_
166+
2. Balanced Random Forest [16]_
167+
3. Balanced Bagging
169168

170169
The different algorithms are presented in the sphinx-gallery_.
171170

appveyor.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ environment:
1010
- PYTHON: "C:\\Miniconda36-x64"
1111
PYTHON_VERSION: "3.6"
1212
PYTHON_ARCH: "64"
13-
OPTIONAL_DEP: "pandas keras tensorflow"
13+
OPTIONAL_DEP: "pandas keras tensorflow=1"
14+
15+
- PYTHON: "C:\\Miniconda36-x64"
16+
PYTHON_VERSION: "3.6"
17+
PYTHON_ARCH: "64"
18+
OPTIONAL_DEP: "pandas tensorflow"
1419

1520
- PYTHON: "C:\\Miniconda36-x64"
1621
PYTHON_VERSION: "3.7"
@@ -30,8 +35,8 @@ install:
3035
- conda update conda -y -q
3136
- conda create -n testenv --yes python=%PYTHON_VERSION% pip
3237
- activate testenv
33-
- conda install scipy numpy -y -q
34-
- conda install scikit-learn -y -q
38+
- conda install scipy numpy joblib -y -q
39+
- pip install --pre -f https://sklearn-nightly.scdn8.secure.raxcdn.com scikit-learn
3540
- conda install %OPTIONAL_DEP% -y -q
3641
- conda install pytest pytest-cov -y -q
3742
- pip install codecov

build_tools/circle/build_doc.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,14 @@ conda update --yes --quiet conda
8888

8989
# Configure the conda environment and put it in the path using the
9090
# provided versions
91-
conda create -n $CONDA_ENV_NAME --yes --quiet python=3.6
91+
conda create -n $CONDA_ENV_NAME --yes --quiet python=3.7
9292
source activate $CONDA_ENV_NAME
9393

94-
conda install --yes pip numpy scipy pillow matplotlib sphinx \
95-
sphinx_rtd_theme numpydoc pandas keras
96-
pip install --pre scikit-learn
94+
conda install --yes pip numpy scipy joblib pillow matplotlib sphinx \
95+
memory_profiler sphinx_rtd_theme pandas keras tensorflow=1
96+
pip install --pre -f https://sklearn-nightly.scdn8.secure.raxcdn.com scikit-learn
9797
pip install -U git+https://github.com/sphinx-gallery/sphinx-gallery.git
98+
pip install -U git+https://github.com/numpy/numpydoc.git
9899

99100
# Build and install imbalanced-learn in dev mode
100101
ls -l

build_tools/travis/install.sh

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,24 @@ if [[ "$DISTRIB" == "conda" ]]; then
2828
MINICONDA_PATH=/home/travis/miniconda
2929
chmod +x miniconda.sh && ./miniconda.sh -b -p $MINICONDA_PATH
3030
export PATH=$MINICONDA_PATH/bin:$PATH
31-
conda config --set always_yes yes --set changeps1 no
32-
conda install conda=4.6
33-
conda update -q conda
34-
conda info -a
3531

3632
# Configure the conda environment and put it in the path using the
3733
# provided versions
3834
conda create -n testenv --yes python=$PYTHON_VERSION pip
3935
source activate testenv
4036
conda install --yes numpy=$NUMPY_VERSION scipy=$SCIPY_VERSION
4137

42-
if [[ "$OPTIONAL_DEPS" == "true" ]]; then
43-
conda install --yes pandas keras tensorflow
38+
if [[ "$OPTIONAL_DEPS" == "keras" ]]; then
39+
conda install --yes pandas keras tensorflow=1
4440
KERAS_BACKEND=tensorflow
4541
python -c "import keras.backend"
4642
sed -i -e 's/"backend":[[:space:]]*"[^"]*/"backend":\ "'$KERAS_BACKEND'/g' ~/.keras/keras.json;
43+
elif [[ "$OPTIONAL_DEPS" == "tensorflow" ]]; then
44+
conda install --yes pandas tensorflow
4745
fi
4846

4947
if [[ "$SKLEARN_VERSION" == "master" ]]; then
50-
conda install --yes cython
51-
pip install -U git+https://github.com/scikit-learn/scikit-learn.git
48+
pip install --pre -f https://sklearn-nightly.scdn8.secure.raxcdn.com scikit-learn
5249
else
5350
conda install --yes scikit-learn=$SKLEARN_VERSION
5451
fi
@@ -65,8 +62,8 @@ elif [[ "$DISTRIB" == "ubuntu" ]]; then
6562
virtualenv --system-site-packages --python=python3 testvenv
6663
source testvenv/bin/activate
6764

68-
pip3 install scikit-learn
69-
pip3 install pandas keras tensorflow
65+
pip install --pre -f https://sklearn-nightly.scdn8.secure.raxcdn.com scikit-learn
66+
pip3 install pandas
7067
pip3 install pytest pytest-cov codecov sphinx numpydoc
7168

7269
fi

doc/api.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,8 @@ Prototype selection
111111
:toctree: generated/
112112
:template: class.rst
113113

114-
ensemble.BalanceCascade
115114
ensemble.BalancedBaggingClassifier
116115
ensemble.BalancedRandomForestClassifier
117-
ensemble.EasyEnsemble
118116
ensemble.EasyEnsembleClassifier
119117
ensemble.RUSBoostClassifier
120118

@@ -251,5 +249,4 @@ Imbalance-learn provides some fast-prototyping tools.
251249

252250
utils.estimator_checks.check_estimator
253251
utils.check_neighbors_object
254-
utils.check_ratio
255252
utils.check_sampling_strategy

doc/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@
265265
sphinx_gallery_conf = {
266266
'doc_module': 'imblearn',
267267
'backreferences_dir': os.path.join('generated'),
268+
'show_memory': True,
268269
'reference_url': {
269270
'imblearn': None}
270271
}

doc/whats_new/v0.6.rst

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,46 @@ Version 0.6.0 (under-development)
66
Changelog
77
---------
88

9+
Changed models
10+
..............
11+
12+
The following models might give some different sampling due to changes in
13+
scikit-learn:
14+
15+
- :class:`imblearn.under_sampling.ClusterCentroid`
16+
- :class:`imblearn.under_sampling.InstanceHardnessThreshold`
17+
18+
Maintenance
19+
...........
20+
21+
- Update imports from scikit-learn after that some modules have been privatize.
22+
The following import have been changed:
23+
:class:`sklearn.ensemble._base._set_random_states`,
24+
:class:`sklearn.ensemble._forest._parallel_build_trees`,
25+
:class:`sklearn.metrics._classification._check_targets`,
26+
:class:`sklearn.metrics._classification._prf_divide`,
27+
:class:`sklearn.utils.Bunch`,
28+
:class:`sklearn.utils._safe_indexing`,
29+
:class:`sklearn.utils._testing.assert_allclose`,
30+
:class:`sklearn.utils._testing.assert_array_equal`,
31+
:class:`sklearn.utils._testing.SkipTest`.
32+
:pr:`617` by :user:`Guillaume Lemaitre <glemaitre>`.
33+
34+
Deprecation
35+
...........
36+
37+
- The following classes have been removed after 2 deprecation cycles:
38+
`ensemble.BalanceCascade` and `ensemble.EasyEnsemble`.
39+
:pr:`617` by :user:`Guillaume Lemaitre <glemaitre>`.
40+
41+
- The following functions have been removed after 2 deprecation cycles:
42+
`utils.check_ratio`.
43+
:pr:`617` by :user:`Guillaume Lemaitre <glemaitre>`.
44+
45+
- The parameter `ratio` and `return_indices` has been removed from all
46+
samplers.
47+
:pr:`617` by :user:`Guillaume Lemaitre <glemaitre>`.
48+
49+
- The parameters `m_neighbors`, `out_step`, `kind`, `svm_estimator`
50+
have been removed from the :class:`imblearn.over_sampling.SMOTE`.
51+
:pr:`617` by :user:`Guillaume Lemaitre <glemaitre>`.

examples/ensemble/plot_comparison_ensemble_classifier.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,8 @@ def plot_confusion_matrix(cm, classes, ax,
111111
# will use a bagging classifier and its counter part which internally uses a
112112
# random under-sampling to balanced each boostrap sample.
113113

114-
bagging = BaggingClassifier(n_estimators=50, random_state=0, n_jobs=-1)
115-
balanced_bagging = BalancedBaggingClassifier(n_estimators=50, random_state=0,
116-
n_jobs=-1)
114+
bagging = BaggingClassifier(n_estimators=50, random_state=0)
115+
balanced_bagging = BalancedBaggingClassifier(n_estimators=50, random_state=0)
117116

118117
bagging.fit(X_train, y_train)
119118
balanced_bagging.fit(X_train, y_train)
@@ -149,9 +148,8 @@ def plot_confusion_matrix(cm, classes, ax,
149148
# outperforming bagging. Here, we used a vanilla random forest and its balanced
150149
# counterpart in which each bootstrap sample is balanced.
151150

152-
rf = RandomForestClassifier(n_estimators=50, random_state=0, n_jobs=-1)
153-
brf = BalancedRandomForestClassifier(n_estimators=50, random_state=0,
154-
n_jobs=-1)
151+
rf = RandomForestClassifier(n_estimators=50, random_state=0)
152+
brf = BalancedRandomForestClassifier(n_estimators=50, random_state=0)
155153

156154
rf.fit(X_train, y_train)
157155
brf.fit(X_train, y_train)
@@ -189,8 +187,7 @@ def plot_confusion_matrix(cm, classes, ax,
189187

190188
base_estimator = AdaBoostClassifier(n_estimators=10)
191189
eec = EasyEnsembleClassifier(n_estimators=10,
192-
base_estimator=base_estimator,
193-
n_jobs=-1)
190+
base_estimator=base_estimator)
194191
eec.fit(X_train, y_train)
195192
y_pred_eec = eec.predict(X_test)
196193
print('Easy ensemble classifier performance:')

0 commit comments

Comments
 (0)