TST Extend tests for scipy.sparse.*array in test_polynomial.py#27166
Conversation
|
It's important to look at the full traceback in the CI report to understand what causes the exception raised at the bottom of the traceback. Here if you walk up the traceback, you will see that the code in scikit-learn causing this error is: ../1/s/sklearn/preprocessing/_polynomial.py:498: in transform
out_col = X[:, col_idx].multiply(out_col)and the message of the exception is: which suggest a potential fix to make the code in scikit-learn compatible with the new sparse arrays: out_col = X[:, [col_idx]].multiply(out_col) |
|
By the way that means that this PR will not just be about updating the tests but actually about fixing something in scikit-learn to add compatibility to the new scipy sparse arrays. Therefore, this PR will need an entry in the changelog ( |
scipy.sparse.*array in test_polynomial.py
…github.com/work-mohit/scikit-learn into fix/preprocessing/tests/test_polynomial.py
|
@ogrisel Have a look on this PR. Let me know if any updates required. Double check the change log file. Thanks ! |
ogrisel
left a comment
There was a problem hiding this comment.
LGTM, thanks for the fix @work-mohit!
glemaitre
left a comment
There was a problem hiding this comment.
LGTM as well. Merging if the CIs turns green.
…cikit-learn#27166) Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
Towards #27090
What does this implement/fix? Explain your changes.
Extended the test cases for the test_polynomial.py file. All tests run smoothly except two:
FAILED sklearn/preprocessing/tests/test_polynomial.py::test_polynomial_features_csc_X[csc_array-4-False-False-float64] - NotImplementedError: We have not yet implemented 1D sparse slices; please index using explicit indices, e.g.
x[:, [0]]FAILED sklearn/preprocessing/tests/test_polynomial.py::test_polynomial_features_csc_X[csc_array-4-False-True-float64] - NotImplementedError: We have not yet implemented 1D sparse slices; please index using explicit indices, e.g.
x[:, [0]]Any other comments?
I've already tried
.Ato.toarray()for csr_arrays but got nothing, the same errors keep coming. Maybe there is another source of error, unable to find it. Feel free to drop your review.