Catalog coverage measures how much of an item catalog appears in at least one recommendation list.
coverage=N∣R∣Here, R is the set of unique recommended item IDs and N is n_items, the total catalog size. Return 0.0 when n_items is zero. Otherwise return the coverage as a float.
Input: recommendations = [[1, 2, 3], [2, 3, 4], [4, 5, 6]], n_items = 10
Output: 0.6
Explanation: Six unique items appear across a catalog of ten items.
Input: recommendations = [[1, 2], [1, 2], [1, 2]], n_items = 5
Output: 0.4
Use one set for items from every recommendation list.
Update the set with each list before dividing its size by n_items.
Sign in to take notes on this problem
Accepts: array
Accepts: number
Catalog coverage measures how much of an item catalog appears in at least one recommendation list.
coverage=N∣R∣Here, R is the set of unique recommended item IDs and N is n_items, the total catalog size. Return 0.0 when n_items is zero. Otherwise return the coverage as a float.
Input: recommendations = [[1, 2, 3], [2, 3, 4], [4, 5, 6]], n_items = 10
Output: 0.6
Explanation: Six unique items appear across a catalog of ten items.
Input: recommendations = [[1, 2], [1, 2], [1, 2]], n_items = 5
Output: 0.4
Use one set for items from every recommendation list.
Update the set with each list before dividing its size by n_items.
Sign in to take notes on this problem
Accepts: array
Accepts: number