-
Notifications
You must be signed in to change notification settings - Fork 72
Add ILS #969
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
Add ILS #969
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #969 +/- ##
==========================================
+ Coverage 88.93% 88.96% +0.03%
==========================================
Files 217 218 +1
Lines 15045 15089 +44
==========================================
+ Hits 13380 13424 +44
Misses 1665 1665 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
mdekstrand
left a comment
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.
the code looks sound, some documentation comments (and we need to fix merge conflicts).
src/lenskit/metrics/ranking/_ils.py
Outdated
| Evaluate recommendation diversity using intra-list similarity (ILS). | ||
|
|
||
| This metric measures the average pairwise cosine similarity between item | ||
| category vectors in a recommendation list. Lower values indicate more diverse |
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.
ILS should not be limited to category vectors - it should also support arbitrary vectors (which is sort-of already the case, since cat_matrix returns the vectors as-is from sparse and dense attribute vectors), but the documentation should reflect the metric's generality.
src/lenskit/metrics/ranking/_ils.py
Outdated
|
|
||
| Args: | ||
| items: Item list to evaluate. | ||
| categories: Item * category matrix (dense or sparse), unit-normalized. |
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.
Related to the other comment on categories vs. other names, let's call this vectors, and otherwise update the docs to reflect that we use vectors.
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.
Document that the rows of the matrix must be unit-normalized.
Issue: #317
Added ILS and tests.