Open tony-theorem opened 2 years ago
Thanks very much for the thorough report, @tony-theorem !!! We really appreciate the time you put into create a reproducible example.
Are you interested in working on a contribution to add this support? We'd be happy to help you with that if you are interested. Otherwise, someone else here will try to pick up the work of adding tests and a fix.
In the future, when opening issues here, please do the following:
basic.py
on master
" may point to something different a year from now than it did at the time you wrote thisAttributeError: flags not found
Description
A
Dataset
cannot be constructed from aSequence
that returns sparse data. This behavior is unexpected asDataset
generally supports sparse data .Reproducible example
Environment info
Python version 3.9.12
Additional Comments
The immediate cause of failure is due to https://github.com/microsoft/LightGBM/blob/master/python-package/lightgbm/basic.py#L1543. Sparse arrays and matrices do not have the
flags
attribute, thus leading to theAttributeError
. Even if this check is removed, aTypeError
will then be encountered in https://github.com/microsoft/LightGBM/blob/master/python-package/lightgbm/basic.py#L1545-L1571 when numpy ufuncs are applied to the sparse data.