Skip to content
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

Filter positive items for ranking evaluation #523

Merged
merged 11 commits into from
Aug 13, 2023

Conversation

tqtg
Copy link
Member

@tqtg tqtg commented Jul 24, 2023

Description

Previously, we did not filter positive items in training when doing evaluation on test/validation set for most of the ranking metrics. As a result, it harms performance of some models that indeed rank those items to the top. In this PR, we first explicitly filter out those items when calling Recommender.rank() function using item_indices, we then modify all ranking metrics to obey this logic. To summarize, positive items in training will not be involved during evaluation.

How are the ranking metrics affected?

  • AUC: not affected - previous logic already took it into account.
  • Precision: affected - expected the results to be increased.
  • Recall: affected - expected the results to be increased.
  • NDCG: affected - expected the results to be increased.
  • NCRR: affected - expected the results to be increased.
  • MAP: affected - expected the results to be increased.
  • MRR: affected - expected the results to be increased.

How are the rating metrics affected?
No. This change only affects ranking metrics.

Related Issues

#503

Checklist:

  • I have added tests.
  • I have updated the documentation accordingly.
  • I have updated README.md (if you are adding a new model).
  • I have updated examples/README.md (if you are adding a new example).
  • I have updated datasets/README.md (if you are adding a new dataset).

@tqtg tqtg requested review from lthoang and saghiles July 24, 2023 21:32
@tqtg
Copy link
Member Author

tqtg commented Jul 24, 2023

Hi @amirj, we're making some changes to how the ranking metrics being computed, and these changes will break the logic of PropensityStratifiedEvaluation. Could you please have a look and see if we could mitigate this with some modification to the eval method?

@tqtg
Copy link
Member Author

tqtg commented Jul 29, 2023

@saghiles @lthoang please help spend some time on this PR and see if this makes sense to you. The best way is to write a few test cases. Let me know if you have any comments

cornac/metrics/ranking.py Outdated Show resolved Hide resolved
Copy link
Member

@saghiles saghiles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tqtg, I left two comments please have a look. The rest looks good to me.

@lthoang
Copy link
Member

lthoang commented Aug 11, 2023

@tqtg The two comments of @saghiles make sense to me. The rests LGTM.

@tqtg
Copy link
Member Author

tqtg commented Aug 11, 2023

@saghiles @lthoang thanks both for the comments which are now fixed. If no further suggestions, I'll go ahead and merge this PR.

@tqtg tqtg force-pushed the filter-positive-items-for-ranking-eval branch from 6c5f332 to 3a1f0ce Compare August 11, 2023 19:38
@tqtg tqtg merged commit b0d6fe8 into PreferredAI:master Aug 13, 2023
@tqtg tqtg deleted the filter-positive-items-for-ranking-eval branch August 13, 2023 04:51
tqtg added a commit that referenced this pull request Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants