Ensure predictions sparse before sp.hstack
in ClassifierChain
#27905
Labels
Needs Triage
Issue requires triage
We use
sp.hstack
in a number of places inClassifierChain
where we may be stacking sparse with dense, e.g.,:scikit-learn/sklearn/multioutput.py
Line 948 in 36f6734
and
scikit-learn/sklearn/multioutput.py
Line 693 in 36f6734
AFAICT it seems stacking a sparse with dense via
sp.hstack
gives you a sparse array (even thoughsp.hstack
is not documented to support dense):Maybe due to: https://github.com/scipy/scipy/blob/f990b1d2471748c79bc4260baf8923db0a5248af/scipy/sparse/_construct.py#L654 ?
Should we ensure y is sparse before using
sp.hstack
?I had quick look at our code, I could not find any other cases where it would be possible to be stacking dense + sparse. I think
ClassifierChain
is unique in that we do not usually combineX
withy
Discussed here: #27700 (comment)
cc @glemaitre
The text was updated successfully, but these errors were encountered: