# How do recommendation systems work?

How do recommendation systems (e.g. on Youtube) work? Apparently, every user gets different recommendations depending on his location, his past liked videos, etc. So it would seem like a training model is applied to every single user, but that can't be possible, so how are these recommendations user-specific without applying a unique training model to every single user?

Let me try to explain how recommender systems work in production, as intuitively as possible:

Let's say we want to build a rec sys. for a restaurant discovery product, where users can rate restaurants, add reviews, photos, etc and also order food from there.

So, the user's feed will have a list of restaurants in his/her area. But, as I gain money from restaurants in the \$-per-click model, I need to maximize the number of times a user clicks on a restaurant.

Also, it is obvious that a user is more likely to click on a restaurant if he tends to like it the most. [Restaurant features being Cost-for-two, cuisines, ratings, etc]

So here, a user is a data point and so is the restaurant. So, let's say the distance between the user vectors and the restaurant is the "likeability" of the user for the restaurant.

Let's say the vector is in the form [Japanese Spanish Mexican Chinese Indian Thai Turkish Lebanese] Let's say a restaurant's vector is: A = [0 0 0 1 1 0 0 0]

and the user's is: B = [2 23 4 53 43 21 2 45]

Each number being a particular cuisine. For restaurant, it is yes or no (1 or 0), a.k.a whether the cuisine is served or not.

For user, it can be the number of clicks he/she did on restaurants with that cuisine. (I am over-simplifying here. But, this can be as complex as a weighted score for clicks+transactions+content_generated like review, ratings, etc)

Now, the the cosine similarity measure between the 2 vectors in an 8-dimensional space (length of the vector) is the likeability score.

Now, the system uses these scores while doing it's feed ranking for each user.

This can be near-realtime to being updated hourly/daily, depending on the servers the company can afford.