I have a database with three tables set up like this:
Users: username, user_id
Products: product_name, product_id
User_Products: product_id, user_id, relation_level
These are all pretty straight forward, when a user clicks to ‘like’ a product, it asks how much they like it (rated 1-5) and stores that information in the User_Products table, storing the product_id from the Products table, user_id from the Users table and relation_level based on how much they like the product.
What I want to do is generate suggestions for products the user might like, based on products the user likes and how much they like the products, getting users who like similar products and finding products the user doesn’t already know about, based on the number of people who like them and the level they like them.
Does anyone have any ideas how I can achieve this?
This sounds like the most classic and canonical of recommender engine problems. Apache Mahout has a complete recommender engine framework, including a simple non-distributed, non-Hadoop version that will be easy to experiment with.
In particular, you will just want to plug in one of the JDBC-based
DataModelimplementations to start in order to read your data. The rest is a few lines of code.Now, I know you said PHP. Mahout is Java. But you can look at setting this up as a web service that your PHP could access.