Skip to content

Commit

Permalink
Release 1.4.2 (#28774)
Browse files Browse the repository at this point in the history
Co-authored-by: Guillaume Lemaitre <guillaume@probabl.ai>
Co-authored-by: Loïc Estève <loic.esteve@ymail.com>
  • Loading branch information
3 people committed Apr 9, 2024
1 parent f07e013 commit d675b8d
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 13 deletions.
2 changes: 2 additions & 0 deletions doc/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ <h4 class="sk-landing-call-header">News</h4>
<li><strong>On-going development:</strong>
<a href="whats_new/v1.5.html#version-1-5-0">scikit-learn 1.5 (Changelog)</a>
</li>
<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>).
</li>
<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>).
</li>
<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>).
Expand Down
9 changes: 9 additions & 0 deletions doc/whats_new/v1.4.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ For a short description of the main highlights of the release, please refer to

.. include:: changelog_legend.inc

.. _changes_1_4_2:

Version 1.4.2
=============

**April 2024**

This release only includes support for numpy 2.

.. _changes_1_4_1:

Version 1.4.1.post1
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ requires = [
"setuptools",
"wheel",
"Cython>=3.0.8",
"numpy>=1.25",
"numpy==2.0.0rc1",
"scipy>=1.6.0",
]

Expand Down
6 changes: 0 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,12 +614,6 @@ def setup_package():
},
)

# Overwrite the dependencies to not allow for NumPy >= 2.0
metadata["install_requires"] = [
f"{dep},<2.0" if dep.startswith("numpy") else dep
for dep in metadata["install_requires"]
]

commands = [arg for arg in sys.argv[1:] if not arg.startswith("-")]
if not all(
command in ("egg_info", "dist_info", "clean", "check") for command in commands
Expand Down
2 changes: 1 addition & 1 deletion sklearn/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
# Dev branch marker is: 'X.Y.dev' or 'X.Y.devN' where N is an integer.
# 'X.Y.dev0' is the canonical version of 'X.Y.dev'
#
__version__ = "1.4.1.post1"
__version__ = "1.4.2"


# On OSX, we can get a runtime error due to multiple OpenMP libraries loaded
Expand Down
2 changes: 1 addition & 1 deletion sklearn/preprocessing/_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ def fit_transform(self, y):
class_mapping[:] = tmp
self.classes_, inverse = np.unique(class_mapping, return_inverse=True)
# ensure yt.indices keeps its current dtype
yt.indices = np.array(inverse[yt.indices], dtype=yt.indices.dtype, copy=False)
yt.indices = np.asarray(inverse[yt.indices], dtype=yt.indices.dtype)

if not self.sparse_output:
yt = yt.toarray()
Expand Down
8 changes: 7 additions & 1 deletion sklearn/preprocessing/tests/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,13 @@ def test_standard_scaler_dtype(add_sample_weight, sparse_container):
else:
sample_weight = None
with_mean = True
for dtype in [np.float16, np.float32, np.float64]:
if sparse_container is not None:
# scipy sparse containers do not support float16, see
# https://github.com/scipy/scipy/issues/7408 for more details.
supported_dtype = [np.float64, np.float32]
else:
supported_dtype = [np.float64, np.float32, np.float16]
for dtype in supported_dtype:
X = rng.randn(n_samples, n_features).astype(dtype)
if sparse_container is not None:
X = sparse_container(X)
Expand Down
7 changes: 5 additions & 2 deletions sklearn/utils/fixes.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,14 +256,17 @@ def _sparse_nan_min_max(X, axis):
from scipy.integrate import trapz as trapezoid # type: ignore # noqa


# TODO: Remove when Pandas > 2.2 is the minimum supported version
# TODO: Adapt when Pandas > 2.2 is the minimum supported version
def pd_fillna(pd, frame):
pd_version = parse_version(pd.__version__).base_version
if parse_version(pd_version) < parse_version("2.2"):
frame = frame.fillna(value=np.nan)
else:
infer_objects_kwargs = (
{} if parse_version(pd_version) >= parse_version("3") else {"copy": False}
)
with pd.option_context("future.no_silent_downcasting", True):
frame = frame.fillna(value=np.nan).infer_objects(copy=False)
frame = frame.fillna(value=np.nan).infer_objects(**infer_objects_kwargs)
return frame


Expand Down
1 change: 0 additions & 1 deletion sklearn/utils/tests/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1632,7 +1632,6 @@ def test_check_pandas_sparse_invalid(ntype1, ntype2):
"ntype1, ntype2, expected_subtype",
[
("double", "longdouble", np.floating),
("float16", "half", np.floating),
("single", "float32", np.floating),
("double", "float64", np.floating),
("int8", "byte", np.integer),
Expand Down

0 comments on commit d675b8d

Please sign in to comment.