Add IPS-weighted RBP (#1155) - #1182
Open
vvineis wants to merge 1 commit into
Open
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1182 +/- ##
==========================================
+ Coverage 89.58% 89.63% +0.05%
==========================================
Files 262 264 +2
Lines 17405 17547 +142
==========================================
+ Hits 15593 15729 +136
- Misses 1812 1818 +6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Member
|
Will provide a more detailed review tomorrow or Monday, but I just cut the 2026.3 release, so this will be targeted for 2026.4.0. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds IPS-weighted RBP (#1155), following Yang et al., "Unbiased Offline Recommender Evaluation for Missing-Not-At-Random Implicit Feedback" (RecSys 2018).
The metric is
IPSRBP. It uses the paper's self-normalized estimator (SNIPS, their eqn. 9) by default;self_normalized=Falsedrops the denominator and gives the plain IPS numerator. Propensities come from aPropensityModelpassed to the constructor:PopularityPropensityimplements their eqn. 15,UniformPropensityis the missing-at-random baseline, andFieldPropensityreads them off a field if you estimated them yourself. There's alsoestimate_power_law_gamma, which fits the exponent from a set of recommendations the way they do in section 4.3.I put the propensities in a separate object rather than as arguments on the metric, partly to follow
MeanPopRankandListGinitaking aDataset, and partly because it mirrorsRankWeight. IPS-corrected Recall or DCG should then just be a matter of reusing it.A few choices:
gammais the paper's exponent, so the(gamma+1)/2of eqn. 15 happens inside the propensity model and values from their Table 2 can be used as-is. It has no default, since it depends on the dataset and on whatever produced the log.Tests
Two identities tie the metric to the existing one, both checked with Hypothesis over random lists, cutoffs and patience values:
self_normalized=Falseis exactlyRBPRBP / |S*_u|I also checked both per user on ml-latest-small and they hold to machine precision.
There's also a small simulated MNAR log where the true reward of eqn. 1 is known: the uncorrected evaluator overstates a popularity-chasing recommender and the correction pulls it back, while on a missing-at-random log the correction leaves the score alone.
One thing I didn't do
The docstrings cite
yangUnbiasedOfflineRecommender2018, which isn't indocs/lenskit.bibyet.@inproceedings{yang2018unbiased,
title={Unbiased offline recommender evaluation for missing-not-at-random implicit feedback},
author={Yang, Longqi and Cui, Yin and Xuan, Yuan and Wang, Chenyang and Belongie, Serge and Estrin, Deborah},
booktitle={Proceedings of the 12th ACM conference on recommender systems},
pages={279--287},
year={2018}
}