# How Can You Make a Restaurant Recommendation from Mastercard Data? source: https://developer.mastercard.com/blog/how-can-you-make-a-restaurant-recommendation-from-mastercard-data/index.md Authors: Chris Merz. Have you ever traveled to a new destination and been faced with the daunting task of finding a place to eat that suits your tastes? Wouldn't it be great if you could ask a concierge, "these are my favorite places back home, what do you have like that here?" Mastercard has the data and algorithms to power such recommendations for dining, entertainment, and shopping. The Data: a graph of merchants A key insight into the development of the recommender capability came from an observation about transaction data -- similar restaurants (in a geographic region) typically have a common set of patrons. By inspection we could see that the term 'similar' could mean any combination of attributes like cuisine, cost, (live) entertainment, seating options (e.g. patio dining), ratings, etc. This insight is valuable because the restaurant attributes themselves are not always available, especially for newer restaurants; but the measure of correspondence can be derived from transaction data. In short, our base of knowledge for making recommendations is simply a continuously updated, large, sparse correspondence graph capturing the relationships between merchants. Each node in the graph is a merchant, and each edge is weighted by the number of common patrons. The example below shows a graph where merchants 'i' and 'j' have 14 common customers. The Algorithm: traversing the graph of merchants The next insight comes from a 'word of mouth' traversal of the graph described above, starting from your favorite places. Imagine walking around your favorite restaurants and asking the other diners what their favorite restaurants are; you could then visit those restaurants, and repeat. The restaurants that show up most often in your survey are the ones you are more likely to prefer. This is called a 'spreading activation' traversal of the graph, and is akin the Google's PageRank algorithm . The figure below shows the spreading activation algorithm by seeding the graph with activation at the known favorites and spreading it out to other strongly connected merchants. Seeding the favorite places at home Iteration 1 Iteration 2 Eventually the search will land in your destination city, and those restaurants with the most activation will be on the recommended list. (OK, there's a little more to it than this because we have to trade off popularity with personalization; but this captures the gist of the recommender algorithm.) Somewhat surprisingly, the recommendations converge rather quickly -- after 5 or 6 iterations of the algorithm. This is consistent with the phenomenon commonly referred to as "six degrees of separation ", where any two people can be connected by a chain of 5 or 6 acquaintenances. Personalization with Privacy by Design Since the graph of merchants is formed via an aggregation process, no individual's patterns are exposed, but the relationships between merchants are captured. The algorithm can work from a user's expressed set of favorite merchants; or, on an opt-in basis, from a payment card's transaction history.