Say i have a large data set that contains the following data;


I would like run through the whole data set and match two users based on ̶t̶a̶s̶t̶e̶s̶
genres and rating that are similar or closer then others like a best match. The gender does not need to be considered, What would be the best algorithm to acquire this result? There is an equal amount of users, Everyone will get a match.

I have taken a look into the stable marriage algorithm (Gale-Shapley) however I would appreciate someone else's suggestion and opinion.


  • 2
    $\begingroup$ The first thing you need to do is define what exactly you mean by "best match". You also need to think about the features: do all features have equal weight? What to do with missing values? Can you pair two males or two females? If not: are there an equal number of males and females? After you have had a closer look at the data and have defined how to measure the quality of a match you can start looking at algorithms. It is probably worth reading about clustering and testing out a few algorithms to see which one works best for you (using the quality measure you chose earlier). $\endgroup$
    – Louic
    Jun 30, 2019 at 18:58
  • $\begingroup$ What do you mean by "match two users based on tastes"? Do you mean that the two users are given as input and the output is a similarity score? Or that one user is given as input and the output is the most similar other user? Or the input is the whole dataset and the output is a list of pairs of similar users? $\endgroup$
    – Erwan
    Jun 30, 2019 at 22:22
  • $\begingroup$ Hey @Erwan thanks for your comment, The latter option is my desired result. I would like to put in a set of users (equal amount), and receive a list of users that the model thinks would 'enjoy' to be paired together. Scoring would be the genres they are interested in and the rating. Thanks again $\endgroup$ Jun 30, 2019 at 22:50
  • $\begingroup$ Thank you @louic for your comment, I have edited my question a little, I will read into clustering. $\endgroup$ Jun 30, 2019 at 22:51

1 Answer 1


Given your data sample, unless you have a more subtle way to measure similarity between different values for a given genre (e.g. some other resource indicating that football is closer to basketball than to tennis for instance), it seems that the only similarity measure that you can use is to count how many tastes two users have in common.

The similarity score can be only 0, 1, 2 or 3, so I don't think you really need clustering. You can simply build a map where the key is the concatenation of the 3 "genre" columns, and the value is the set of users which have these tastes. Some users might not have an exact match (3 identical genres), so you do the same process but for only 2 genres in common, and then for only one.

  • $\begingroup$ Thank you, I can understand how i will go about this now. I will mark as solved. thanks again for all your help and teaching! $\endgroup$ Jul 1, 2019 at 15:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.