Skip to content

Commit d675b8d

Browse files
jeremiedbbglemaitrelesteve
authored
Release 1.4.2 (#28774)
Co-authored-by: Guillaume Lemaitre <guillaume@probabl.ai> Co-authored-by: Loïc Estève <loic.esteve@ymail.com>
1 parent f07e013 commit d675b8d

File tree

9 files changed

+26
-13
lines changed

9 files changed

+26
-13
lines changed

doc/templates/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ <h4 class="sk-landing-call-header">News</h4>
169169
<li><strong>On-going development:</strong>
170170
<a href="whats_new/v1.5.html#version-1-5-0">scikit-learn 1.5 (Changelog)</a>
171171
</li>
172+
<li><strong>April 2024.</strong> scikit-learn 1.4.2 is available for download (<a href="whats_new/v1.4.html#version-1-4-2">Changelog</a>).
173+
</li>
172174
<li><strong>February 2024.</strong> scikit-learn 1.4.1.post1 is available for download (<a href="whats_new/v1.4.html#version-1-4-1-post1">Changelog</a>).
173175
</li>
174176
<li><strong>January 2024.</strong> scikit-learn 1.4.0 is available for download (<a href="whats_new/v1.4.html#version-1-4-0">Changelog</a>).

doc/whats_new/v1.4.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ For a short description of the main highlights of the release, please refer to
1313

1414
.. include:: changelog_legend.inc
1515

16+
.. _changes_1_4_2:
17+
18+
Version 1.4.2
19+
=============
20+
21+
**April 2024**
22+
23+
This release only includes support for numpy 2.
24+
1625
.. _changes_1_4_1:
1726

1827
Version 1.4.1.post1

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ requires = [
44
"setuptools",
55
"wheel",
66
"Cython>=3.0.8",
7-
"numpy>=1.25",
7+
"numpy==2.0.0rc1",
88
"scipy>=1.6.0",
99
]
1010

setup.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -614,12 +614,6 @@ def setup_package():
614614
},
615615
)
616616

617-
# Overwrite the dependencies to not allow for NumPy >= 2.0
618-
metadata["install_requires"] = [
619-
f"{dep},<2.0" if dep.startswith("numpy") else dep
620-
for dep in metadata["install_requires"]
621-
]
622-
623617
commands = [arg for arg in sys.argv[1:] if not arg.startswith("-")]
624618
if not all(
625619
command in ("egg_info", "dist_info", "clean", "check") for command in commands

sklearn/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
# Dev branch marker is: 'X.Y.dev' or 'X.Y.devN' where N is an integer.
4343
# 'X.Y.dev0' is the canonical version of 'X.Y.dev'
4444
#
45-
__version__ = "1.4.1.post1"
45+
__version__ = "1.4.2"
4646

4747

4848
# On OSX, we can get a runtime error due to multiple OpenMP libraries loaded

sklearn/preprocessing/_label.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ def fit_transform(self, y):
827827
class_mapping[:] = tmp
828828
self.classes_, inverse = np.unique(class_mapping, return_inverse=True)
829829
# ensure yt.indices keeps its current dtype
830-
yt.indices = np.array(inverse[yt.indices], dtype=yt.indices.dtype, copy=False)
830+
yt.indices = np.asarray(inverse[yt.indices], dtype=yt.indices.dtype)
831831

832832
if not self.sparse_output:
833833
yt = yt.toarray()

sklearn/preprocessing/tests/test_data.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,13 @@ def test_standard_scaler_dtype(add_sample_weight, sparse_container):
208208
else:
209209
sample_weight = None
210210
with_mean = True
211-
for dtype in [np.float16, np.float32, np.float64]:
211+
if sparse_container is not None:
212+
# scipy sparse containers do not support float16, see
213+
# https://github.com/scipy/scipy/issues/7408 for more details.
214+
supported_dtype = [np.float64, np.float32]
215+
else:
216+
supported_dtype = [np.float64, np.float32, np.float16]
217+
for dtype in supported_dtype:
212218
X = rng.randn(n_samples, n_features).astype(dtype)
213219
if sparse_container is not None:
214220
X = sparse_container(X)

sklearn/utils/fixes.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,14 +256,17 @@ def _sparse_nan_min_max(X, axis):
256256
from scipy.integrate import trapz as trapezoid # type: ignore # noqa
257257

258258

259-
# TODO: Remove when Pandas > 2.2 is the minimum supported version
259+
# TODO: Adapt when Pandas > 2.2 is the minimum supported version
260260
def pd_fillna(pd, frame):
261261
pd_version = parse_version(pd.__version__).base_version
262262
if parse_version(pd_version) < parse_version("2.2"):
263263
frame = frame.fillna(value=np.nan)
264264
else:
265+
infer_objects_kwargs = (
266+
{} if parse_version(pd_version) >= parse_version("3") else {"copy": False}
267+
)
265268
with pd.option_context("future.no_silent_downcasting", True):
266-
frame = frame.fillna(value=np.nan).infer_objects(copy=False)
269+
frame = frame.fillna(value=np.nan).infer_objects(**infer_objects_kwargs)
267270
return frame
268271

269272

sklearn/utils/tests/test_validation.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1632,7 +1632,6 @@ def test_check_pandas_sparse_invalid(ntype1, ntype2):
16321632
"ntype1, ntype2, expected_subtype",
16331633
[
16341634
("double", "longdouble", np.floating),
1635-
("float16", "half", np.floating),
16361635
("single", "float32", np.floating),
16371636
("double", "float64", np.floating),
16381637
("int8", "byte", np.integer),

0 commit comments

Comments
 (0)