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
Top k multi error #2178
Top k multi error #2178
Conversation
@btrotta Thank you very much for your contribution! Seems that your new tests fail on Python 2.7. Can you please take a look? Also please move them to the existent |
We already have |
yes, I think it is better to change the parameter name. |
…se number of training rounds so loss is larger and easier to compare.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems that new behavior differs from previous one in case of model predicts all classes to be equally likely.
Consider topk@1 and score = [0.33, 0.33, 0.33]
Old:
LossOnPoint => 1.0
New:
LossOnPoint => 0.0
@StrikerRUS Good point! I've fixed this in the latest commit. The metric is now defined so that the top-k error on a sample is 0 if there are at least |
@btrotta Thank you for hotfixing that! LightGBM/src/metric/map_metric.hpp Lines 38 to 40 in 0a4a7a8
The only thing I'm doubt about is that we cannot change multi_error -> multi_error@1 due to backward compatibility with users' existing codebase which relies on the previous name. So, it should be a special case.
|
@StrikerRUS Done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Now the general concept looks good to me. Just several nitpicks below for the consistency with existing codebase and formatting style.
Formatting issues fixed in latest commit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@btrotta Thank you very much for your contribution!
LGTM except two comments below!
@StrikerRUS Thanks so much for your careful review! Those 2 issues with docs are fixed now. |
@guolinke Can you please give a second review to this PR? |
it looks good to me |
@guolinke Should this PR be in 2.2.4 release? |
@StrikerRUS yeah, it can be. |
@guolinke Then I'm merging 😃 |
Implements the feature requested in issue #1139 . Added new parameter top_k_threshold. When the metric is set to
multi_error
, parametertop_k_threshold
can be used to obtain the top-k multi-error. By default this parameter is set to 1, which gives the usual multi-error.