1. Definition

Diversity measures how different the recommended items are from each other within a single recommendation list.

  • Goal: Avoid showing a user five items that are nearly identical (e.g., all movies from the same franchise).
  • A diverse recommendation list provides variety to the user.

2. Intuition

  • Imagine Netflix recommends:
    • Low Diversity: 5 Marvel superhero movies in Top-5.
    • High Diversity: A drama, a comedy, a documentary, a sci-fi, and an action movie.

Both lists may be accurate, but the second list is more engaging because it’s varied.


3. Formal Measurement

One common way: Intra-List Diversity (ILD)

$Diversity = \frac{2}{K(K-1)} \sum_{i=1}^K \sum_{j=i+1}^K (1 – sim(i,j))$

Higher value = items are less similar → more diverse list.


4. Example

Top-3 recommendations for a user:

  • Movie A (Action), Movie B (Action), Movie C (Romantic Comedy)
  • If similarity(Action, Action) ≈ 1, similarity(Action, Romantic Comedy) ≈ 0.1
  • Average dissimilarity = higher when genres differ → more diverse.

So:

  • List [Action, Action, Action] → very low diversity.
  • List [Action, Comedy, Documentary] → much higher diversity.

5. Why It Matters

  • User Satisfaction: Prevents boredom, increases engagement.
  • Discovery: Exposes users to different categories.
  • Business Goals: Encourages broader consumption (not just bestsellers).

6. Limitations

  • Too much diversity may hurt accuracy (showing things irrelevant to the user).
  • Needs balance between relevance and diversity (exploration vs exploitation).

7. Python Example

import numpy as np

def intra_list_diversity(recommendations, similarity_matrix):
    """
    recommendations: list of item IDs in a recommendation list
    similarity_matrix: precomputed similarity between items (numpy array)
    """
    k = len(recommendations)
    if k <= 1:
        return 0
    
    total = 0
    count = 0
    for i in range(k):
        for j in range(i+1, k):
            sim = similarity_matrix[recommendations[i], recommendations[j]]
            total += (1 - sim)  # dissimilarity
            count += 1
    return total / count

# Example similarity matrix (0=identical, 1=very different)
sim_matrix = np.array([
    [1.0, 0.8, 0.2],
    [0.8, 1.0, 0.3],
    [0.2, 0.3, 1.0]
])

recommendations = [0, 1, 2]
div_score = intra_list_diversity(recommendations, sim_matrix)
print("Diversity:", div_score)

Summary

  • Diversity = how different items in a recommendation list are.
  • High diversity → broader, more varied recommendations.
  • Common metric: Intra-List Diversity (ILD).
  • Must balance with accuracy and relevance.