-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[python] Dataset
cannot be constructed from sparse Sequence
#5207
Comments
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:
|
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.The text was updated successfully, but these errors were encountered: