tensorflow / tensorflow/recommenders
[Question]: How to handle negative samples?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2k
- Forks
- 300
- PR merge metrics
- No merged PRs in 30d
Description
Hi @maciejkula thanks again for a great library!
I have another question which is a little theoretical, I would like to understand how to handle negative examples explicitly in this library. So as a dataset we provide positive rows (person x product_purchased) and the library handles selecting negative examples when training.
However in some domains it is important to provide explicit negative samples, for example in advertising we have (ad x web_page) and most of the time a cross happens it will create no positive interaction say a click. So to measure how well a specific ad performs on a specific page you need to know how many times it was shown, so you end up with:
ad. | page | clicks | impressions
shoes. | shopping.com. | 10. | 1000
From which we can calculate a click rate (CTR).
So my question is how best to handle such a dataset, where there is not just a positive interaction, but there is also data about how many times that positive interaction would have had a chance to form.
My basic idea:
- decide a threshold for a "good" CTR, and convert to binary labels
- add a weight per sample based on the number of impressions, more impressions would be a higher weight
- drop all negative examples from the data set
But I am sure there is a better way! Any help would be appreciated!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No file, test, or entry point is named. Start by reviewing how the library represents positive interactions and selects negatives during training, then determine whether impression counts can be represented directly. Done would require an agreed approach for explicit negative or exposure data and corresponding documentation or implementation scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, tensorflow
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100