Novelty measures how uncommon the recommended items are. An item seen by fewer users carries more self-information and therefore receives a higher novelty value.
novelty=∣R∣1i∈R∑−log2(Nci)Here, R is recommendations, c_i is item_counts[i], and N is n_users. Return the average novelty of the recommended items. Return 0.0 when recommendations is empty.
Input: recommendations = [0, 1], item_counts = [100, 100], n_users = 100
Output: 0.0
Explanation: Both items were seen by every user, so each has zero self-information.
Input: recommendations = [0, 1], item_counts = [1, 1], n_users = 100
Output: 6.6439
Use -math.log2(item_counts[item] / n_users) for one item.
Divide the accumulated novelty by len(recommendations).
Sign in to take notes on this problem
Accepts: array
Accepts: array
Accepts: number
Novelty measures how uncommon the recommended items are. An item seen by fewer users carries more self-information and therefore receives a higher novelty value.
novelty=∣R∣1i∈R∑−log2(Nci)Here, R is recommendations, c_i is item_counts[i], and N is n_users. Return the average novelty of the recommended items. Return 0.0 when recommendations is empty.
Input: recommendations = [0, 1], item_counts = [100, 100], n_users = 100
Output: 0.0
Explanation: Both items were seen by every user, so each has zero self-information.
Input: recommendations = [0, 1], item_counts = [1, 1], n_users = 100
Output: 6.6439
Use -math.log2(item_counts[item] / n_users) for one item.
Divide the accumulated novelty by len(recommendations).
Sign in to take notes on this problem
Accepts: array
Accepts: array
Accepts: number