Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 947f542

Browse files
glemaitrethomasjpfanjeremiedbblucyleeowjustmarkham
authored
REL backport fixes for 0.23.2 (#18068)
Co-authored-by: Thomas J. Fan <[email protected]> Co-authored-by: Jérémie du Boisberranger <[email protected]> Co-authored-by: Lucy Liu <[email protected]> Co-authored-by: Kevin Markham <[email protected]> Co-authored-by: Juan Carlos Alfaro Jiménez <[email protected]> Co-authored-by: Forrest Koch <[email protected]> Co-authored-by: Chiara Marmo <[email protected]> Co-authored-by: Swier <[email protected]> Co-authored-by: t-kusanagi2 <[email protected]> Co-authored-by: Markus Rempfler <[email protected]> Co-authored-by: Olivier Grisel <[email protected]> Co-authored-by: Bruno Charron <[email protected]> Co-authored-by: Bruno Charron <[email protected]> Co-authored-by: amy12xx <[email protected]> Co-authored-by: Allan <[email protected]> Co-authored-by: Roman Yurchak <[email protected]> Co-authored-by: Hirofumi Suzuki <[email protected]> Co-authored-by: Loïc Estève <[email protected]> Co-authored-by: Joel Nothman <[email protected]> Co-authored-by: Charles Patel <[email protected]>
1 parent 24e7be0 commit 947f542

Some content is hidden

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

60 files changed

+895
-528
lines changed

.binder/requirements.txt

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
--extra-index https://pypi.anaconda.org/scipy-wheels-nightly/simple scikit-learn
2-
--pre
31
matplotlib
42
scikit-image
53
pandas
64
sphinx-gallery
7-
scikit-learn
8-
5+
scikit-learn>=0.23,<0.24

build_tools/azure/test_script.cmd

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ mkdir %TMP_FOLDER%
1010
cd %TMP_FOLDER%
1111

1212
if "%CHECK_WARNINGS%" == "true" (
13-
set PYTEST_ARGS=%PYTEST_ARGS% -Werror::DeprecationWarning -Werror::FutureWarning
13+
REM numpy's 1.19.0's tostring() deprecation is ignored until scipy and joblib removes its usage
14+
set PYTEST_ARGS=%PYTEST_ARGS% -Werror::DeprecationWarning -Werror::FutureWarning -Wignore:tostring:DeprecationWarning
1415
)
1516

1617
if "%COVERAGE%" == "true" (

build_tools/azure/test_script.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ if [[ "$COVERAGE" == "true" ]]; then
2929
fi
3030

3131
if [[ -n "$CHECK_WARNINGS" ]]; then
32-
TEST_CMD="$TEST_CMD -Werror::DeprecationWarning -Werror::FutureWarning"
32+
# numpy's 1.19.0's tostring() deprecation is ignored until scipy and joblib removes its usage
33+
TEST_CMD="$TEST_CMD -Werror::DeprecationWarning -Werror::FutureWarning -Wignore:tostring:DeprecationWarning"
3334
fi
3435

3536
if [[ "$PYTHON_VERSION" == "*" ]]; then

conftest.py

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

88
import platform
99
import sys
10-
from distutils.version import LooseVersion
1110
import os
1211

1312
import pytest
@@ -17,10 +16,11 @@
1716
from sklearn.utils import _IS_32BIT
1817
from sklearn.externals import _pilutil
1918
from sklearn._build_utils.deprecated_modules import _DEPRECATED_MODULES
19+
from sklearn.utils.fixes import np_version, parse_version
2020

2121
PYTEST_MIN_VERSION = '3.3.0'
2222

23-
if LooseVersion(pytest.__version__) < PYTEST_MIN_VERSION:
23+
if parse_version(pytest.__version__) < parse_version(PYTEST_MIN_VERSION):
2424
raise ImportError('Your version of pytest is too old, you should have '
2525
'at least pytest >= {} installed.'
2626
.format(PYTEST_MIN_VERSION))
@@ -54,8 +54,7 @@ def pytest_collection_modifyitems(config, items):
5454
# run doctests only for numpy >= 1.14.
5555
skip_doctests = False
5656
try:
57-
import numpy as np
58-
if LooseVersion(np.__version__) < LooseVersion('1.14'):
57+
if np_version < parse_version('1.14'):
5958
reason = 'doctests are only run for numpy >= 1.14'
6059
skip_doctests = True
6160
elif _IS_32BIT:

doc/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080

8181
# General information about the project.
8282
project = 'scikit-learn'
83-
copyright = '2007 - 2019, scikit-learn developers (BSD License)'
83+
copyright = '2007 - 2020, scikit-learn developers (BSD License)'
8484

8585
# The version info for the project you're documenting, acts as replacement for
8686
# |version| and |release|, also used in various other places throughout the

doc/modules/linear_model.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -997,8 +997,8 @@ Examples of use cases include:
997997
* Risk modeling / insurance policy pricing: number of claim events /
998998
policyholder per year (Poisson), cost per event (Gamma), total cost per
999999
policyholder per year (Tweedie / Compound Poisson Gamma).
1000-
* Predictive maintenance: number of production interruption events per year:
1001-
Poisson, duration of interruption: Gamma, total interruption time per year
1000+
* Predictive maintenance: number of production interruption events per year
1001+
(Poisson), duration of interruption (Gamma), total interruption time per year
10021002
(Tweedie / Compound Poisson Gamma).
10031003

10041004

doc/modules/model_persistence.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Persistence example
2020
-------------------
2121

2222
It is possible to save a model in scikit-learn by using Python's built-in
23-
persistence model, namely `pickle <https://docs.python.org/2/library/pickle.html>`_::
23+
persistence model, namely `pickle <https://docs.python.org/3/library/pickle.html>`_::
2424

2525
>>> from sklearn import svm
2626
>>> from sklearn import datasets

doc/templates/index.html

+4
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ <h4 class="sk-landing-call-header">News</h4>
155155
<ul class="sk-landing-call-list list-unstyled">
156156
<li><strong>On-going development:</strong>
157157
<a href="https://scikit-learn.org/dev/whats_new.html"><strong>What's new</strong> (Changelog)</a>
158+
<li><strong>August 2020.</strong> scikit-learn 0.23.2 is available for download (<a href="whats_new/v0.23.html#version-0-23-2">Changelog</a>).
159+
</li>
160+
<li><strong>May 2020.</strong> scikit-learn 0.23.1 is available for download (<a href="whats_new/v0.23.html#version-0-23-1">Changelog</a>).
161+
</li>
158162
<li><strong>May 2020.</strong> scikit-learn 0.23.0 is available for download (<a href="whats_new/v0.23.html#version-0-23-0">Changelog</a>).
159163
</li>
160164
<li><strong>Scikit-learn from 0.23 requires Python 3.6 or greater.</strong>

doc/themes/scikit-learn-modern/static/css/theme.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,12 @@ span.highlighted {
8383
}
8484

8585
div.highlight {
86-
padding: 0.2rem 0.5rem;
8786
border: 1px solid #ddd;
8887
margin-bottom: 1rem;
8988
}
9089

9190
div.highlight pre {
91+
padding: 0.2rem 0.5rem;
9292
margin-bottom: 0;
9393
line-height: 1.2rem;
9494
}

doc/whats_new/v0.23.rst

+121-6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,122 @@
22

33
.. currentmodule:: sklearn
44

5+
.. _changes_0_23_2:
6+
7+
Version 0.23.2
8+
==============
9+
10+
**August 3 2020**
11+
12+
Changed models
13+
--------------
14+
15+
The following estimators and functions, when fit with the same data and
16+
parameters, may produce different models from the previous version. This often
17+
occurs due to changes in the modelling logic (bug fixes or enhancements), or in
18+
random sampling procedures.
19+
20+
- |Fix| ``inertia_`` attribute of :class:`cluster.KMeans` and
21+
:class:`cluster.MiniBatchKMeans`.
22+
23+
Details are listed in the changelog below.
24+
25+
(While we are trying to better inform users by providing this information, we
26+
cannot assure that this list is complete.)
27+
28+
Changelog
29+
---------
30+
31+
:mod:`sklearn.cluster`
32+
......................
33+
34+
- |Fix| Fixed a bug in :class:`cluster.KMeans` where rounding errors could
35+
prevent convergence to be declared when `tol=0`. :pr:`17959` by
36+
:user:`Jérémie du Boisberranger <jeremiedbb>`.
37+
38+
- |Fix| Fixed a bug in :class:`cluster.KMeans` and
39+
:class:`cluster.MiniBatchKMeans` where the reported inertia was incorrectly
40+
weighted by the sample weights. :pr:`17848` by
41+
:user:`Jérémie du Boisberranger <jeremiedbb>`.
42+
43+
- |Fix| Fixed a bug in :class:`cluster.MeanShift` with `bin_seeding=True`. When
44+
the estimated bandwidth is 0, the behavior is equivalent to
45+
`bin_seeding=False`.
46+
:pr:`17742` by :user:`Jeremie du Boisberranger <jeremiedbb>`.
47+
48+
- |Fix| Fixed a bug in :class:`cluster.AffinityPropagation`, that
49+
gives incorrect clusters when the array dtype is float32.
50+
:pr:`17995` by :user:`Thomaz Santana <Wikilicious>` and
51+
:user:`Amanda Dsouza <amy12xx>`.
52+
53+
:mod:`sklearn.decomposition`
54+
............................
55+
56+
- |Fix| Fixed a bug in
57+
:func:`decomposition.MiniBatchDictionaryLearning.partial_fit` which should
58+
update the dictionary by iterating only once over a mini-batch.
59+
:pr:`17433` by :user:`Chiara Marmo <cmarmo>`.
60+
61+
- |Fix| Avoid overflows on Windows in
62+
:func:`decomposition.IncrementalPCA.partial_fit` for large ``batch_size`` and
63+
``n_samples`` values.
64+
:pr:`17985` by :user:`Alan Butler <aldee153>` and
65+
:user:`Amanda Dsouza <amy12xx>`.
66+
67+
:mod:`sklearn.ensemble`
68+
.......................
69+
70+
- |Fix| Fixed bug in :class:`ensemble.MultinomialDeviance` where the
71+
average of logloss was incorrectly calculated as sum of logloss.
72+
:pr:`17694` by :user:`Markus Rempfler <rempfler>` and
73+
:user:`Tsutomu Kusanagi <t-kusanagi2>`.
74+
75+
- |Fix| Fixes :class:`ensemble.StackingClassifier` and
76+
:class:`ensemble.StackingRegressor` compatibility with estimators that
77+
do not define `n_features_in_`. :pr:`17357` by `Thomas Fan`_.
78+
79+
:mod:`sklearn.feature_extraction`
80+
.................................
81+
82+
- |Fix| Fixes bug in :class:`feature_extraction.text.CountVectorizer` where
83+
sample order invariance was broken when `max_features` was set and features
84+
had the same count. :pr:`18016` by `Thomas Fan`_, `Roman Yurchak`_, and
85+
`Joel Nothman`_.
86+
87+
:mod:`sklearn.linear_model`
88+
...........................
89+
90+
- |Fix| :func:`linear_model.lars_path` does not overwrite `X` when
91+
`X_copy=True` and `Gram='auto'`. :pr:`17914` by `Thomas Fan`_.
92+
93+
:mod:`sklearn.manifold`
94+
.......................
95+
96+
- |Fix| Fixed a bug where :func:`metrics.pairwise_distances` would raise an
97+
error if ``metric='seuclidean'`` and ``X`` is not type ``np.float64``.
98+
:pr:`15730` by :user:`Forrest Koch <ForrestCKoch>`.
99+
100+
:mod:`sklearn.metrics`
101+
......................
102+
103+
- |Fix| Fixed a bug in :func:`metrics.mean_squared_error` where the
104+
average of multiple RMSE values was incorrectly calculated as the root of the
105+
average of multiple MSE values.
106+
:pr:`17309` by :user:`Swier Heeres <swierh>`.
107+
108+
:mod:`sklearn.pipeline`
109+
.......................
110+
111+
- |Fix| :class:`pipeline.FeatureUnion` raises a deprecation warning when
112+
`None` is included in `transformer_list`. :pr:`17360` by `Thomas Fan`_.
113+
114+
:mod:`sklearn.utils`
115+
....................
116+
117+
- |Fix| Fix :func:`utils.estimator_checks.check_estimator` so that all test
118+
cases support the `binary_only` estimator tag.
119+
:pr:`17812` by :user:`Bruno Charron <brcharron>`.
120+
5121
.. _changes_0_23_1:
6122

7123
Version 0.23.1
@@ -23,6 +139,7 @@ Changelog
23139
provided by the user were modified in place. :pr:`17204` by
24140
:user:`Jeremie du Boisberranger <jeremiedbb>`.
25141

142+
26143
Miscellaneous
27144
.............
28145

@@ -44,8 +161,6 @@ refer to
44161

45162
.. include:: changelog_legend.inc
46163

47-
Put the changes in their relevant module.
48-
49164
Enforcing keyword-only arguments
50165
--------------------------------
51166

@@ -171,7 +286,7 @@ Changelog
171286
deprecated. It has no effect. :pr:`11950` by
172287
:user:`Jeremie du Boisberranger <jeremiedbb>`.
173288

174-
- |API| The ``random_state`` parameter has been added to
289+
- |API| The ``random_state`` parameter has been added to
175290
:class:`cluster.AffinityPropagation`. :pr:`16801` by :user:`rcwoolston`
176291
and :user:`Chiara Marmo <cmarmo>`.
177292

@@ -364,7 +479,7 @@ Changelog
364479
for each feature. :pr:`16403` by :user:`Narendra Mukherjee <narendramukherjee>`.
365480

366481
- |Enhancement| :class:`impute.SimpleImputer`, :class:`impute.KNNImputer`, and
367-
:class:`impute.SimpleImputer` accepts pandas' nullable integer dtype with
482+
:class:`impute.IterativeImputer` accepts pandas' nullable integer dtype with
368483
missing values. :pr:`16508` by `Thomas Fan`_.
369484

370485
:mod:`sklearn.inspection`
@@ -467,7 +582,7 @@ Changelog
467582
an error when `y_true` and `y_pred` were length zero and `labels` was
468583
not `None`. In addition, we raise an error when an empty list is given to
469584
the `labels` parameter.
470-
:pr:`16442` by `Kyle Parsons <parsons-kyle-89>`.
585+
:pr:`16442` by :user:`Kyle Parsons <parsons-kyle-89>`.
471586

472587
- |API| Changed the formatting of values in
473588
:meth:`metrics.ConfusionMatrixDisplay.plot` and
@@ -491,7 +606,7 @@ Changelog
491606
:pr:`15622` by :user:`Gregory Morse <GregoryMorse>`.
492607

493608
- |Fix| :func:`model_selection.cross_val_predict` supports
494-
`method="predict_proba"` when `y=None`.:pr:`15918` by
609+
`method="predict_proba"` when `y=None`. :pr:`15918` by
495610
:user:`Luca Kubin <lkubin>`.
496611

497612
- |Fix| :func:`model_selection.fit_grid_point` is deprecated in 0.23 and will

examples/cluster/plot_coin_segmentation.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import time
2626

2727
import numpy as np
28-
from distutils.version import LooseVersion
2928
from scipy.ndimage.filters import gaussian_filter
3029
import matplotlib.pyplot as plt
3130
import skimage
@@ -34,9 +33,10 @@
3433

3534
from sklearn.feature_extraction import image
3635
from sklearn.cluster import spectral_clustering
36+
from sklearn.utils.fixes import parse_version
3737

3838
# these were introduced in skimage-0.14
39-
if LooseVersion(skimage.__version__) >= '0.14':
39+
if parse_version(skimage.__version__) >= parse_version('0.14'):
4040
rescale_params = {'anti_aliasing': False, 'multichannel': False}
4141
else:
4242
rescale_params = {}

examples/cluster/plot_coin_ward_segmentation.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import time as time
1818

1919
import numpy as np
20-
from distutils.version import LooseVersion
2120
from scipy.ndimage.filters import gaussian_filter
2221

2322
import matplotlib.pyplot as plt
@@ -28,9 +27,10 @@
2827

2928
from sklearn.feature_extraction.image import grid_to_graph
3029
from sklearn.cluster import AgglomerativeClustering
30+
from sklearn.utils.fixes import parse_version
3131

3232
# these were introduced in skimage-0.14
33-
if LooseVersion(skimage.__version__) >= '0.14':
33+
if parse_version(skimage.__version__) >= parse_version('0.14'):
3434
rescale_params = {'anti_aliasing': False, 'multichannel': False}
3535
else:
3636
rescale_params = {}

examples/compose/plot_transformed_target.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import numpy as np
2222
import matplotlib
2323
import matplotlib.pyplot as plt
24-
from distutils.version import LooseVersion
2524

2625
print(__doc__)
2726

@@ -34,10 +33,11 @@
3433
from sklearn.linear_model import RidgeCV
3534
from sklearn.compose import TransformedTargetRegressor
3635
from sklearn.metrics import median_absolute_error, r2_score
36+
from sklearn.utils.fixes import parse_version
3737

3838

3939
# `normed` is being deprecated in favor of `density` in histograms
40-
if LooseVersion(matplotlib.__version__) >= '2.1':
40+
if parse_version(matplotlib.__version__) >= parse_version('2.1'):
4141
density_param = {'density': True}
4242
else:
4343
density_param = {'normed': True}

examples/decomposition/plot_sparse_coding.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@
1616
"""
1717
print(__doc__)
1818

19-
from distutils.version import LooseVersion
20-
2119
import numpy as np
2220
import matplotlib.pyplot as plt
2321

2422
from sklearn.decomposition import SparseCoder
23+
from sklearn.utils.fixes import np_version, parse_version
2524

2625

2726
def ricker_function(resolution, center, width):
@@ -68,7 +67,7 @@ def ricker_matrix(width, resolution, n_components):
6867
('Lasso', 'lasso_lars', 2, None, 'turquoise'), ]
6968
lw = 2
7069
# Avoid FutureWarning about default value change when numpy >= 1.14
71-
lstsq_rcond = None if LooseVersion(np.__version__) >= '1.14' else -1
70+
lstsq_rcond = None if np_version >= parse_version('1.14') else -1
7271

7372
plt.figure(figsize=(13, 6))
7473
for subplot, (D, title) in enumerate(zip((D_fixed, D_multi),

examples/miscellaneous/plot_johnson_lindenstrauss_bound.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919
import numpy as np
2020
import matplotlib
2121
import matplotlib.pyplot as plt
22-
from distutils.version import LooseVersion
2322
from sklearn.random_projection import johnson_lindenstrauss_min_dim
2423
from sklearn.random_projection import SparseRandomProjection
2524
from sklearn.datasets import fetch_20newsgroups_vectorized
2625
from sklearn.datasets import load_digits
2726
from sklearn.metrics.pairwise import euclidean_distances
27+
from sklearn.utils.fixes import parse_version
2828

2929
# `normed` is being deprecated in favor of `density` in histograms
30-
if LooseVersion(matplotlib.__version__) >= '2.1':
30+
if parse_version(matplotlib.__version__) >= parse_version('2.1'):
3131
density_param = {'density': True}
3232
else:
3333
density_param = {'normed': True}

0 commit comments

Comments
 (0)