Click-through rate (CTR) prediction is a crucial task in recommender systems. We have a dataset of user-item interactions, where each interaction is represented as a tuple of user ID, item ID, and click status (1 for clicked, 0 for not clicked). We want to predict the CTR for each interaction.
Example:
We have the following dataset:
user_item_interactions = [(1, 1, 1), (1, 2, 0), (2, 1, 1), (2, 3, 0), (3, 1, 1), (3, 2, 0), (3, 4, 1), (4, 1, 0), (4, 2, 1), (4, 3, 0)]
Constraints:
Write a function to predict the CTR for each interaction in the dataset.
Test Cases
Test Case 1
Input:
[[1, 1, 1], [1, 2, 0], [2, 1, 1], [2, 3, 0], [3, 1, 1], [3, 2, 0], [3, 4, 1], [4, 1, 0], [4, 2, 1], [4, 3, 0]]Expected:
[0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5]Test Case 2
Input:
[[1, 1, 1], [1, 2, 0], [2, 1, 1], [2, 3, 0], [3, 1, 1], [3, 2, 0], [3, 4, 1], [4, 1, 0], [4, 2, 1], [4, 3, 0]]Expected:
[0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5]+ 3 hidden test cases