# How to match a user with another user based on their taste?

Information available

Consider that there are N users on a platform. Every user adds items that they like on their profile. These items have static attributes that describe the product.

User A:
Row   | Attribute a | Attribute b | Attribute c
Item 1|    0.593    |    0.7852   |   0.484
Item 2|    0.18     |    0.96     |   0.05
Item 3|    0.423    |    0.886    |   0.156

User B:
Row   | Attribute a | Attribute b | Attribute c
Item 7|    0.228    |    0.148    |   0.658
Item 8|    0.785    |    0.33     |   0.887
Item 9|    0.569    |    0.994    |   0.374


User A has a list of items that he/she likes. Same goes with User B... User N. The items in the profiles of different users might or might not be the same but the items describe the User's taste for that particular item.

Goal

What I want to do is, match a User with another User if they have a similar taste in picking items. I don't understand how to achieve this. Any help is appreciated!

You can perform clustering of your customers based on a distance function. Definition might look like this:

1. First, calculate euclidean distances between the first item of the first customer's basket and all of the items in the second customer's basket.
2. Then find out, what is the closest item from second customer's basket (minimum euclidean distance).
3. Perform the same operation for each item in first customer's basket.
4. Calculate mean of the minimum distances.
5. Do the same for the second customer.
6. Take maximum of means from the first and the second customer.
• Don't you think the amount of computation required will be too much? – Dhaval Thakkar Mar 9 at 16:06
• It depends on the number of users (N) and the distribution of a basket size per user. If N is large, but a basket size is small then the execution time should be just a little more expensive than standard clustering. If the size of a basket is large then you can reduce its size by performing some initial clustering of items, based on the chosen algorithm (i.e. hierarchical clustering). – Michał Kardach Mar 13 at 22:21

Well you could try unsupervised clustering. You may want to leave out the user and item label to start. Depending on how much data you have and guesses at how many "categories" you might end up with you can use K-means or Mean sift clustering. The idea would be you let the similarities be worked out so that you group the items together and give you the "Categories" and there for the similar items. Then you can use the model for any future. After you have done this you can introduce the User labels and item labels to build the similarity at the User level.

A next step in exploration, depending on the item and attributes, might be reducing the attributes to the average of each item so that one user has averages of each attribute for all items and then use that data. Then you then averages to cluster in terms of types of "user"

Both ways would assume the attributes for each item is very similar the attributes to the others items. eg

    item  | sweetness   |   acidity   |  bitterness
orange|    0.593    |    0.7852   |   0.484
banana|    0.18     |    0.96     |   0.05
apple |    0.423    |    0.886    |   0.156


Or you can just do direct numerical comparison between users so that you calculate something like statistical entropy between the two across all items per attribute, average for all attributes, and set a range so that if in a certain range they are considered similar or different.

Hope this helps!

• the idea of using unsupervised learning is great but that would only be useful if I had a dataset of all the items from which users could add them. The problem I have is that these items and their attributes will be given to me by an API, so there is no chance that I can get the dataset of all items and their attributes. Also, I couldn't understand the part you said after model building to introduce user and item labels for similarities – Dhaval Thakkar Feb 24 at 17:55

Is there a reason why you are not using a content-based recommender system? You can use a recommender to "group" users together and once they are grouped, you can introduce members to each other. I guess I don't understand why you are trying to re-invent the wheel on this one - a recommender can get you to where you want to be.

• I don't know much about recommender systems but surely I'll give it a shot. I thought using classifiers on every user would help me group users in a better way. – Dhaval Thakkar Feb 26 at 7:40

As suggested, running a clustering algorithm such as k-Means probably works best. The algorithm can find hidden patterns in your dataset.

For fun, I used your data to run a k-Means in Tableau (freely available). Tableau makes experimenting with clustering algorithms super easy and fast.

You see immediately that you have two similar groups (Cluster 1 in blue and Cluste r2 in orange).