Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Implement A Recommendation System?

I've Collective Intelligence book, but I'm not sure how it can be apply in practical.

Let say I have a PHP website with mySQL database. User can insert articles with title and content in the database. For the sake of simplicity, we just compare the title.

  • How to Make Coffee?
  • 15 Things About Coffee.
  • The Big Question.
  • How to Sharpen A Pencil?
  • Guy Getting Hit in Balls

We open 'How to Make Coffee?' article and because there are similarity in words with the second and fourth title, they will be displayed in Related Article section.

How can I implement this using PHP and mySQL? It's ok if I have to use Python. Thanks in advance.

like image 666
Azam Avatar asked Jun 10 '11 05:06

Azam


1 Answers

Store a set of keywords alongside each product, which should essentially be everything in the title besides a set of stop words. When a title is displayed, you find any other products which share keywords in common (with those with one or more in common given priority).

You could further enhance this by assigning a score to each keyword based on its scarcity (with more scarce words being given a higher score, as a match on 'PHP', for instance, is going to be more relevant than a match on 'programming'), or by tracking the number of times a user navigates manually between a set of products.

Regardless you'd best start off by making it simple, and then enhance it as you go on. Depending on the size of your database more advanced techniques may not be all that fruitful.

like image 178
Justin Simon Avatar answered Sep 19 '22 22:09

Justin Simon