Skip to content

Commit 0e0df36

Browse files
ogrisellesteve
andauthored
FIX test_csr_polynomial_expansion_index_overflow on [scipy-dev] (scikit-learn#30393)
Co-authored-by: Loïc Estève <[email protected]>
1 parent 1dc003b commit 0e0df36

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

sklearn/preprocessing/tests/test_polynomial.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,8 +1050,10 @@ def test_csr_polynomial_expansion_index_overflow(
10501050
`scipy.sparse.hstack`.
10511051
"""
10521052
data = [1.0]
1053-
row = [0]
1054-
col = [n_features - 1]
1053+
# Use int32 indices as much as we can
1054+
indices_dtype = np.int32 if n_features - 1 <= np.iinfo(np.int32).max else np.int64
1055+
row = np.array([0], dtype=indices_dtype)
1056+
col = np.array([n_features - 1], dtype=indices_dtype)
10551057

10561058
# First degree index
10571059
expected_indices = [

0 commit comments

Comments
 (0)