Skip to content
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-package] [c++] support scipy sparse arrays #6352

Closed
jameslamb opened this issue Mar 5, 2024 · 1 comment
Closed

[python-package] [c++] support scipy sparse arrays #6352

jameslamb opened this issue Mar 5, 2024 · 1 comment

Comments

@jameslamb
Copy link
Collaborator

jameslamb commented Mar 5, 2024

Summary

LightGBM currently has APIs to support two formats of sparse matrices:

  • CSC = "Compressed Sparse Column"
  • CSR = "Compressed Sparse Row"

In the Python library scipy, these are represented by classes scipy.sparse.csc_matrix and scipy.sparse.csr_matrix, respectively.

Per scipy's docs (link)

This package is switching to an array interface, compatible with NumPy arrays, from the older matrix interface. We recommend that you use the array objects (bsr_array, coo_array, etc.) for all new work.

lightgbm should add support for scipy.sparse.csc_array and scipy.sparse.csr_array in all places that currently support the corresponding *_matrix classes.

Motivation

Allows continued use of scipy sparse types with lightgbm, even after future scipy releases remove those matrix types.

Description

See the discussion in #6348 for more information.

References

Created based on this comment: #6348 (comment)

Good visual summary of these types: https://matteding.github.io/2019/04/25/sparse-matrices/#compressed-sparse-rowcolumn

@jameslamb jameslamb changed the title [python-package] support scipy sparse arrays [python-package] [c++] support scipy sparse arrays Mar 5, 2024
@StrikerRUS
Copy link
Collaborator

Closed in favor of being in #2302. We decided to keep all feature requests in one place.

Welcome to contribute this feature! Please re-open this issue (or post a comment if you are not a topic starter) if you are actively working on implementing this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants