jma127 / pyltr

Python learning to rank (LTR) toolkit
BSD 3-Clause "New" or "Revised" License
463 stars 107 forks source link

Update ap.py #6

Closed songweige closed 7 years ago

songweige commented 7 years ago

Hi Jerry,

I met AssertionError when running lambdamart with Z = MAP. Then I check the calculation on swap_deltas. And I found that there might be a mistake in your algorithm which caused the error. Maybe you can check it by use some examples.

Cheers

songweige commented 7 years ago

i.e. The denominator of MAP should be the total number of relevant documents instead of the number of relevant document before truncation. Otherwise, for example, we have document list(1, 0, 0, 0, 0, 0, 1). If we swap i=5 and i=7, then the MAP@5 will reduce from 1 to 0.7.

jma127 commented 7 years ago

Hi Songwei, it looks like you are correct. Thanks for catching this!

jma127 commented 7 years ago

Tests are failing due to one test case [1, 0, 1, 0, 1], fixing now.

songweige commented 7 years ago

You're welcomeXD

songweige commented 7 years ago

Got it. Thanks for your codes, too. They are really helpful.

jma127 commented 7 years ago

So glad you find it useful :).

On Jun 29, 2017 09:58, "SongweiGe" notifications@github.com wrote:

Got it. Thanks for your codes, too. They are really helpful.

— You are receiving this because you modified the open/close state.

Reply to this email directly, view it on GitHub https://github.com/jma127/pyltr/pull/6#issuecomment-311974914, or mute the thread https://github.com/notifications/unsubscribe-auth/ACptEmpNJayihIVMNaVRKnw0tv8gJ2yAks5sI62hgaJpZM4OI6JV .