I want to build a recommender system for a coupons website which should do the following: Given the past purchase behaviour of a user, recommend coupons which the user is likely to buy. The data does not have any ratings for coupons by the user. It tells if a user bought a certain coupon or not, which category did it belong to, what is the gender and location of the user who bought these coupons etc.? I am implementing an item to item collaborative filtering. Based on what I have learnt through videos available on this topic, the following is my approach:

  1. Build an item profile of all the coupons with attributes such as category of the coupon, location the coupon is available in and the days on which the coupon can be redeemed.
  2. Build a user profile of all the registered users with attributes such as age, gender, and location.

Now I am making an item and user matrix, where I will have Coupons on the rows and Users in the columns. I will fill 0 and 1 depending on if a coupon C1 was bought by a user U1 in the past or not. In the same dataset, for the coupons for which I want to predict, I will calculate a score based on cosine similarity between items.

My question is if I am using just 0s and 1s (coupon bought or not) to recommend coupons, what is the use of the item and user profile? How I can incorporate the intelligence in the recommendation system that if a user has bought more coupons from X category in the past than recommend him new Y coupons from the same category? I read online about using random forests etc. to calculate "weights" of the attributes in recommendation systems, where do they fit in this scenario?

P.S. I am doing everything in R.

Many thanks in advance for any advice/suggestions.

  • $\begingroup$ Did you figure this out? I am stuck with a similar problem. $\endgroup$ Oct 26, 2018 at 16:22
  • $\begingroup$ I would recommend reading the answer below, it is very helpful. $\endgroup$
    – T.H.
    Oct 30, 2018 at 15:51

1 Answer 1


You can use your item and user profiles to generate a prediciton function (i.e. a function that will predict how relevant a coupon will be for a user, also known as a representation for your items and users). Typical functions used for this purpose are Dot Product and Cosine Similarity. This step ensures the intelligence in the recommendations will incorporate categories information.

Once your scores are predicted, you must compare them to your historical interactions by using a loss function (some examples are Root-mean-square-error and Kullback-Leibler divergence). This step will produce an error that you can use to inform your algorithm for learning (e.g. adjust the weights in your representation functions for items and users).

For more details I strongly suggest you to check out the great slides compiled by James Kirk, which provide a framework to unify the research that has been done on the topic.

  • $\begingroup$ This is very well explained and useful. Thanks a lot. $\endgroup$
    – T.H.
    Oct 30, 2018 at 15:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.