# How to measure a relationship between interests of topics between two users?

I was trying to find a way to calculate the relationship between two Users and their interests. A user can have multiples interests, and an interest can be duplicated in a user's interests. Example:

User1: { interests: {"golf": 3, "baseball: 1", "tenis: 2"} } User2: { interests: {"golf": 5, "baseball": 1, "football": 4} } User3: { interests: {"golf": 1, "baseball": 1, "tenis": 1} } 

### Comparing User1 & User2:

They have in common 2 interests, but User2 seems to be a very fan of golf.

### Comparing User1 & User2:

They have in common 3 interests, while User3 seems to have a slightly interest in all common interests, not being a very fan of any interests listed.

### What I want do to is

The relationship between User1 and User2 should be a higher number than the relationship between User1 and User3, knowing that User3 has only a superficial interest in the topics, and User2 is more likely to be a fan like User1 to golf, for example, meaning that they may want to know each other and etc.

e.g. User1&User2 = 2.5; User1&User3 = 1.8

I tried to use the mean of the intersection of all interests between User-k and User-y and it seemed a reasonable approach, but I think it can have a better way to do this. Suggestions?

Thanks!

• Welcome to the site! Your topic model isn't ideal. I would use a Dirichlet distribution to model each user's interest, then compare users by a divergence like Kullback-Leilber or Jensen-Shannon. Or even the cosine similarity if the divergence is too slow.
– Emre
Nov 3 '17 at 17:19

## 1 Answer

You can create a sparse user-interest matrix, impute missing values with some reasonable value, and apply a similarity function. E.g., center all non-missing values on 0 and mutate each value to adjust for the user's and interest's mean. Then impute 0s for all missing data, and use a traditional similarity function like cosine.

You might also use Bayesian methods. You could model the relationship between users and interests. In this way you wouldn't have to impute missing data and it would account for confidence in inference and prediction.