-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
In Multiclass-Classification eval methods gets a 1D array instead of a 2D array #5113
Comments
Hi @datajanko, thank you for the very detailed description. The change to using 2D collections in multi-class classification was merged after the 3.3.2 release, so it isn't available in that version. If you want to use it you can install from GitHub or install from the nightly builds. If you're unable to do that you have to use 1D arrays as described in the note here. Please let us know if you have further doubts. |
I'm sorry I thought I used the latest version and didn't expect this to change so drastically. Also I didn't find an open Issue that mentions this. I guess I'll just use the workaround I hinted at above in my metric, i.e. reshape using the Fortran order. I guess we can close this issue, right? Thanks for the quick response! |
No worries. Thanks for the detailed report. |
+1, AWESOME report with reproducible example, we really really appreciate the time you put into writing that up. |
This issue has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this. |
Description
When adding evaluation set and a custom evaluation metric in the multi class classification case, the evaluation of the iteration does not receive a 2D matrix but a vector.
Specifically, the eval function shall expect the following shapes of y_pred:
But in the multi class case this does not work, see below
Reproducible example
Output
So we see an array of shape 28 which is 4(classes) * 7 (rows) but not an array.
Environment info
LightGBM version or commit hash:
3.3.2
Command(s) you used to install LightGBM
Additional Comments
I wanted to implement something like a (continuous) ranked probability score function. And I needed to compute the cumulative sum across axis=1 which fails. Errors seem to happen around the
__inner_eval
functionWe are seeing the code to do the reshaping here:
LightGBM/python-package/lightgbm/basic.py
Line 3903 in 3ed0027
but for whatever reason, we don't seem to enter that branch 🤔
The text was updated successfully, but these errors were encountered: