fix sparse multiclass local feature contributions and add test #3382
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR to fix sparse multiclass local feature contributions and add test.
This is a follow-up to this previous PR from me that was merged but had a bug in the multiclass case:
#3000
This PR addresses bugs for multiclass case for both CSR and CSC matrixes:
1.) For CSR case, the indices array was getting overwritten for each matrix, so I added a 'matrix_offsets' array
2.) For CSC case, we were not incrementing col_ptr_index and matrix_start_indices was filled in invalid way
3.) Also, I added optimization to CSC case by parallelizing the code by matrix
The PR also adds a python test for multiclass sparse feature contributions case, which is similar to the test in the previous PR.
This bug was discovered in the https://github.com/interpretml/interpret-community repository when updating to lightgbm 3.0 in the sparse multiclass tests.