# Calculating user preferences based on purchases: how to incorporate different variables for comparison

I am trying to come up with a metric to calculate user preference correlation for my final project (a web-shop for shoes) at school. Originally I intended to include user ratings and use Pearson's correlation coefficient but building a rating system might be part of the exam so I have to leave that to the side for now.

I decided to compare purchases directly, taking binary values based on the number of purchases from the first user. This, of course, isn't terribly accurate. So, after looking at the various attributes of the shoes, I am trying to incorporate preferences in brands and style.

For each shoe that is bought by both a 1 is awarded (0 if the shoe is bought only by user1), for brands and styles I was thinking 0.8 and 0.6 respectively.

But then I lose the thread. I am not sure how to combine the variables in a relevant way. I would really appreciate any hints or tips.

(Also, this is a part of the project that I decided to build in myself and is most definitely not required. I am not attempting to cheat by asking here; I just want to learn.)

## 1 Answer

After staring at it for a good while, I came to the conclusion that I could, in fact, use Pearson's.

I dropped the direct comparison with shoes bought and instead took "Brand", "Style" and "Material" as variables.

For each user I take all the shoes they have bought, from that I calculate the number and kinds of brands, styles and materials and store these in dictionaries. So if the user bought 10 pairs of adidas these 10 would count as his rating of the brand.

The intersect of the dictionary keys supplies the values for the Pearson. At the end I add them together and divide by 3; probably not the best or most elegant solution but it works.