In the previous post we looked at how to start with the outcomes desired by product and work out objectives and corresponding metrics for the recommendation system from those. We also briefly alluded to metrics that promote the diversity of the results returned by the recommender system. In this post we will:
Discuss why diversity of results is important.
Explain a machine learning method of boosting diversity in recommendations.
Walk through an example of this method.
Let’s explain diversity through a simple example in the image above. The recommendations on the right appear more diversified compared to the ones on left. List on right captures my three major interests: I watch basketball highlights, my kids watch Peppa Pig videos and (sometimes!) I watch ML lectures.
Why diversity? “the only free lunch”
Boosting the diversity of the actions has been a time tested approach to improving performance. In this article we are talking about diversity of results and the results shown are the actions the “recsys” can take to satisfy the user without knowing with certainty what the user was looking for.
Diversification of actions has been useful in other fields as well. In portfolio management, Nobel prize winner Harry Markowitz called diversification “the only free lunch in finance”. In autonomous driving, the IntentNet paper introduced a paradigm for predicting the behavior of agents while diversifying over the set of intents they could have and not just predicting the most likely path.
What is common to these approaches is that the prediction system is subject to variation in what the user, the environment or other actors might want to do.
While our prediction system tries to do a good job of modeling the intents of the unobserved environment, it needs to be humble and accept the possibility of mistakes / uncertainty in its prediction of the environment.
Diversity of a slate versus diversity across multiple visits of the user
Before we talk about how to implement diversity, we should recognize that there are two ways of adding diversity to recommendations.
Diversity of a single set of results
For each visit of the user the recommendations shown could cover a number of interests that the user might had.For instance, in the image above on the left the results are shown in a decreasing order of likelihood of the user clicking on them. The ranked list on the right chooses to show items from a different category than the ones already shown.
Diversity across multiple visits of the same user
Imagine you have a user coming to your page fairly regularly, say at least once a day. You have some idea from past behavior of their interests but their interests are not narrow. In such a scenario you might want to add an element of exploration in each visit. You could add this exploration / noise in the ranking at an item level or also at a genre / category level (See image below).If you are wondering why this might be better than Diversity in a slate, I encourage you to not try to compare them. These are just different ways to look at the problem and could be additive to your problem. One advantage of the second option is that it would reduce the cognitive load of the user. Instead of each result being very different the user can quickly browse and skip a topic if that is not what they are looking for.
An overlapping concept with this form of diversity is impression demotion, a topic which we will cover in greater detail in future.
In this article though we are only concerning ourselves with diversity of a slate of recommendations.
System design of diversity boosting
In terms of system design, diversity boosting can be added at various stages:
Having multiple candidate generators. For instance, having a candidate generator that skews towards popular content and one that skews towards personal results ensures that we have a good set of results to diversify the slate.
After we have computed a ranking score for each result, we will rank items in a way that boosts for diversity (look at the second last step in the flow chart above)
In the rest of the article we will focus on a way to implement diversity boosted ranking.
Diversity boosted ranking using Maximal Marginal Relevance
The idea in this method, Maximal Marginal Relevance (MMR) is to iteratively select a recommendation from the yet unselected set of recommendations based on what maximizes adjusted relevance, i.e. relevance to the user - k * similarity to previously selected results.
For each item, set
relevance(item)
= Score from ranking model for that item.For first K = 10 steps:
Select the item with the highest(1-ß)*relevance - ß * Similarity(item, previously selected set)
Sort the remaining items in descending order of
(1-ß)*relevance - ß * Similarity(item, previously selected set)
and add them in this order to the final ranked list.
Example
Suppose we are using Maximal Marginal Relevance based ranking to rank items A1, A2, B1, B2, C where A1 is very similar to A2, like say A1 and A2 are NBA highlights videos, B1 and B2 are say very similar Peppa Pig videos and C is on a different topic.
The initial ranking scores are: {[A1, 1], [A2, 0.8], [B1, 0.6], [B2, 0.4], [C, 0.2]}.
If we rank purely based on score then the order would be: {A1, A2, B1, B2, C}.
However, using MMR the order is {A1, B1, C, A2, B2}. Let’s see how.
As shown in the image above, the first item selected is A1.
After selecting A1 the similarity penalty of A2 becomes 1. Hence the Marginal Relevance of A2 is no longer the highest after A1. A1’s marginal relevance = (0.5 * 0.8) - (0.5 * 1) = -0.1
B1 is now the item with the highest Marginal Relevance. Hence the second item selected is B1.
Similarly after A1 and B1 are selected both A2 and B2 have a similarity penalty of 1. Now C is the item with the highest marginal relevance.
Continuing along this line, we will see that A2 and B2 will be selected. The final order is thus A1, B1, C, A2, B2.
Key takeaways
Diversity boosting is very likely to improve search / recommendation quality, especially when the user could have multiple intents or interests. (Increased CTR by 73% in an industrial recsys I am personally experienced with.)
There are advantages of adding diversity boosting in both retrieval and ranking.
To implement diversity boosted ranking, Maximal Marginal Relevance is an easy and very successful approach. This approach powers some of the most successful recommender systems today.
In a future post, we will cover other ways of implementing diversity boosted ranking.
Disclaimer: These are my personal opinions only. Any assumptions, opinions stated here are mine and not representative of my current or any prior employer(s).