FIX make 'array-like' reject sparse containers in parameter validation#28101
FIX make 'array-like' reject sparse containers in parameter validation#28101glemaitre merged 9 commits intoscikit-learn:mainfrom
Conversation
…tes/2024-01-29.md#need-attention-reviews
|
My opinion is to let the definition of "array-like" in our glossary (https://scikit-learn.org/stable/glossary.html#term-array-like) be our ground truth and build upon that. Based on the glossary, an array-like is something that gives a meaningful result when you run Regarding the implications on #27950, I think for now it's fine to keep "sparse matrix" for both sparse matrices and sparse arrays. After all we left "sparse matrix" in all docstrings for now as well (although at some point we may want to rename it to sparse container or sparse array everywhere). I pushed a commit that I took from #27950 to test param_validation against sparse containers in this PR since it's related and I think we should discard everything else in #27950. @glemaitre What do you think ? |
Fixes #28099. This still needs discussions, see the referenced issue, as for whether to close this PR or how to improve it.
"array-like" is currently a superset of "sparse matrix" which I do not think is the desired behavior, so this PR excludes sparse containers from the "array-like" constraints.
The other modifications are according to the failing tests, so essentially I added the "sparse matrix" option if (1) originally it has only "array-like" and (2) there exist at least some tests that use sparse matrices as input.
https://github.com/scikit-learn/administrative/blob/master/meeting_notes/2024-01-29.md#need-attention-reviews