3

I am trying to find the best algorithm to create a list of recommendations for a user based on the interests of all other users.

Say I have a list of of samples:

$samples = [
    ['hot dog', 'big mac', 'whopper'],
    ['hot dog', 'big mac'],
    ['hot dog', 'whopper'],
    ['big mac', 'dave single'],
    ['whopper', 'mcnuggets', 'mcchicken'],
    ['mcchicken', 'original chicken sandwich'],
    ['mcchicken', 'mcrib']
];

And we will say each array in the sample list is unique user's food preferences.

Let's say now I have a user with this food preference:

['hot dog', 'mcchicken']

I want to be able to recommend to this user other foods that other users have in their preferences.

So in the simplest terms, it should return:

['whopper', 'big mac', 'original chicken sandwich', 'mcrib', 'mcnuggets']

Obviously I will also introduce other variables such as how each user rates each item in their preference list and also the percentage of users that need to have that item in order to use their other food items as recommendations.

But I would like to find the best algorithm to start working on it.

At first I thought Apriori might be my best guess, but I wasn't having luck once I introduced multiple items.

nbro
  • 42,615
  • 12
  • 119
  • 217
zen
  • 133
  • 3

1 Answers1

3

You can use Collaborative Filtering, and specifically its memory based approach.

The problem that you have discussed in the question should probably be solved using user-item collaborative filtering, which will calculate similarity between users and then recommend the item.

The similarity can be be calculated using cosine similarity or Pearson's similarity formulae.

The best thing about this approach is that no training is required here but if you wish to have very large data, this approach's performance decreases.

nbro
  • 42,615
  • 12
  • 119
  • 217