From 685b66f3b7c53608661223d7b89d9e2a99b452ea Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Fri, 24 Mar 2023 15:56:02 +0100 Subject: [PATCH 1/2] MAINT Extend message for large sparse matrices support Hint for reporting minimal reproducer so that we can study new use-cases. --- sklearn/utils/tests/test_validation.py | 2 +- sklearn/utils/validation.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/sklearn/utils/tests/test_validation.py b/sklearn/utils/tests/test_validation.py index 5c9379facf366..81b12591fea91 100644 --- a/sklearn/utils/tests/test_validation.py +++ b/sklearn/utils/tests/test_validation.py @@ -625,7 +625,7 @@ def test_check_array_accept_large_sparse_raise_exception(X_64bit): # When large sparse are not allowed msg = ( "Only sparse matrices with 32-bit integer indices " - "are accepted. Got int64 indices." + "are accepted. Got int64 indices. Please do report" ) with pytest.raises(ValueError, match=msg): check_array(X_64bit, accept_sparse=True, accept_large_sparse=False) diff --git a/sklearn/utils/validation.py b/sklearn/utils/validation.py index eb56caa5e65e4..38e5cc2ca4e87 100644 --- a/sklearn/utils/validation.py +++ b/sklearn/utils/validation.py @@ -973,8 +973,11 @@ def _check_large_sparse(X, accept_large_sparse=False): indices_datatype = getattr(X, key).dtype if indices_datatype not in supported_indices: raise ValueError( - "Only sparse matrices with 32-bit integer" - " indices are accepted. Got %s indices." % indices_datatype + "Only sparse matrices with 32-bit integer indices are accepted." + f" Got {indices_datatype} indices. Please do report a minimal" + " reproducer on scikit-learn issue tracker so that support for" + " your use-case can be study by maintainers. See:" + " https://scikit-learn.org/dev/developers/minimal_reproducer.html" ) From bb6b24e46da5dd31ac75a648f7bc7d418c5910c6 Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Fri, 24 Mar 2023 11:08:46 -0400 Subject: [PATCH 2/2] DOC Fix conjugation Co-authored-by: Meekail Zain <34613774+Micky774@users.noreply.github.com> --- sklearn/utils/validation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sklearn/utils/validation.py b/sklearn/utils/validation.py index 38e5cc2ca4e87..1fb14ff573b50 100644 --- a/sklearn/utils/validation.py +++ b/sklearn/utils/validation.py @@ -976,7 +976,7 @@ def _check_large_sparse(X, accept_large_sparse=False): "Only sparse matrices with 32-bit integer indices are accepted." f" Got {indices_datatype} indices. Please do report a minimal" " reproducer on scikit-learn issue tracker so that support for" - " your use-case can be study by maintainers. See:" + " your use-case can be studied by maintainers. See:" " https://scikit-learn.org/dev/developers/minimal_reproducer.html" )