[HIVEMALL-124][BUGFIX] Fixed bugs in BinaryResponseMeasure (nDCG, MRR, AP) #115
Conversation
@takuti could you review this PR? |
} | ||
return 0.d; | ||
} | ||
final int k = Math.min(rankedList.size(), recommendSize); |
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.
Computing Math.min(rankedList.size(), recommendSize)
twice at here and inside of TruePositives
looks redundant and a little bit confusing. For the sake of simplicity, how about directly writing what TruePositives
does both in Precision
and Recall
, and remove TruePositives
? Even though the same for-loop appears twice, I personally feel it's much more easier to understand.
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.
Fixed in 759b088
Recall is as it is.
if (nTruePositive == 0) { | ||
return 0.d; | ||
} | ||
return sumPrecision / nTruePositive; |
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.
👍
Ideally, it should be |
What changes were proposed in this pull request?
Fixed bug in the BinaryResponse measure such as nDCG, MRR, (M)AP.
What type of PR is it?
Bug Fix
What is the Jira issue?
https://issues.apache.org/jira/browse/HIVEMALL-124
How was this patch tested?
unit tests, manual tests
Checklist
mvn formatter:format
, for your commit?