From 787db5acab7895bc4447a0ae530a04e94d99c861 Mon Sep 17 00:00:00 2001 From: Christian Lorentzen Date: Sun, 30 Apr 2023 13:12:08 +0200 Subject: [PATCH 1/3] DOC fix link to User Guide encoder_infrequent_categories --- examples/release_highlights/plot_release_highlights_1_1_0.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/release_highlights/plot_release_highlights_1_1_0.py b/examples/release_highlights/plot_release_highlights_1_1_0.py index 8ab297ea07671..16887b5b1b493 100644 --- a/examples/release_highlights/plot_release_highlights_1_1_0.py +++ b/examples/release_highlights/plot_release_highlights_1_1_0.py @@ -106,7 +106,7 @@ # :class:`OneHotEncoder` supports aggregating infrequent categories into a single # output for each feature. The parameters to enable the gathering of infrequent # categories are `min_frequency` and `max_categories`. See the -# :ref:`User Guide ` for more details. +# :ref:`User Guide ` for more details. from sklearn.preprocessing import OneHotEncoder import numpy as np From e787d6e70ede544845a8a43bd3db2988ad2e4b45 Mon Sep 17 00:00:00 2001 From: Christian Lorentzen Date: Sun, 30 Apr 2023 14:25:54 +0200 Subject: [PATCH 2/3] TST SplineTransformer raises --- sklearn/preprocessing/tests/test_polynomial.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sklearn/preprocessing/tests/test_polynomial.py b/sklearn/preprocessing/tests/test_polynomial.py index f21c37fb694fa..c42b98ed10024 100644 --- a/sklearn/preprocessing/tests/test_polynomial.py +++ b/sklearn/preprocessing/tests/test_polynomial.py @@ -28,6 +28,22 @@ def is_c_contiguous(a): assert np.isfortran(est(order="F").fit_transform(X)) +@pytest.mark.parametrize( + "params, err_msg", + [ + ({"knots": [[1]]}, r"Number of knots, knots.shape\[0\], must be >= 2."), + ({"knots": [[1, 1], [2, 2]]}, r"knots.shape\[1\] == n_features is violated"), + ({"knots": [[1], [0]]}, "knots must be sorted without duplicates."), + ], +) +def test_spline_transformer_input_validation(params, err_msg): + """Test that we raise errors for invalid input in SplineTransformer.""" + X = [[1], [2]] + + with pytest.raises(ValueError, match=err_msg): + SplineTransformer(**params).fit(X) + + @pytest.mark.parametrize("extrapolation", ["continue", "periodic"]) def test_spline_transformer_integer_knots(extrapolation): """Test that SplineTransformer accepts integer value knot positions.""" From d88a83f17d1382241ff66eb27ebcd1249607a410 Mon Sep 17 00:00:00 2001 From: Christian Lorentzen Date: Sun, 30 Apr 2023 14:27:57 +0200 Subject: [PATCH 3/3] Revert "TST SplineTransformer raises" This reverts commit e787d6e70ede544845a8a43bd3db2988ad2e4b45. --- sklearn/preprocessing/tests/test_polynomial.py | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/sklearn/preprocessing/tests/test_polynomial.py b/sklearn/preprocessing/tests/test_polynomial.py index c42b98ed10024..f21c37fb694fa 100644 --- a/sklearn/preprocessing/tests/test_polynomial.py +++ b/sklearn/preprocessing/tests/test_polynomial.py @@ -28,22 +28,6 @@ def is_c_contiguous(a): assert np.isfortran(est(order="F").fit_transform(X)) -@pytest.mark.parametrize( - "params, err_msg", - [ - ({"knots": [[1]]}, r"Number of knots, knots.shape\[0\], must be >= 2."), - ({"knots": [[1, 1], [2, 2]]}, r"knots.shape\[1\] == n_features is violated"), - ({"knots": [[1], [0]]}, "knots must be sorted without duplicates."), - ], -) -def test_spline_transformer_input_validation(params, err_msg): - """Test that we raise errors for invalid input in SplineTransformer.""" - X = [[1], [2]] - - with pytest.raises(ValueError, match=err_msg): - SplineTransformer(**params).fit(X) - - @pytest.mark.parametrize("extrapolation", ["continue", "periodic"]) def test_spline_transformer_integer_knots(extrapolation): """Test that SplineTransformer accepts integer value knot positions."""