I need to build a recommendation system with lots of information about users (age, sex, location, income etc), but very sparse information about users' prefernces (i.e 1-2 products consumed out of 100 for each user). I have about 50 thousand records and think that using users' profiles may prove useful.

My first reaction as an economist would be using conditional multinomial logit. According to an insightful post here, it may not be a good idea.

Can anybody prompt me what kind of the recommendation algorithm should I use? (R package is of particular interest)

  • $\begingroup$ There's actually a very thorough class on recommender systems going on right now through Coursera. I'm not sure if it's too late to sign up, but if you're able to I suggest you investigate some of the content there: class.coursera.org/recsys-001/class $\endgroup$
    – David Marx
    Nov 13, 2013 at 14:06
  • $\begingroup$ I prefer books and articles, but thanks for suggestion, will look at it $\endgroup$
    – RInatM
    Nov 13, 2013 at 14:26

2 Answers 2


I would also look at the naive Bayes recommender system as it is quick to run, easy to describe to colleagues and clients, and it can be run without estimating tuning parameters.

As for K Nearest Neighbours, I would recommend that you use nested cross validation to test your model. The inner loop can be used to optimise the 'k' value, and the outer loop can be used to give you an estimate of model accuracy.

Then, once you have estimated model accuracy for these models, you could try other models to see if you can increase the accuracy (or other metric used to estimate model performance).

As for articles, I recommend that you look up those regarding the Netflix prize for inspiration.


K nearest neighbors is a simple solution you could use (although it might be too slow for your needs). There are several implementations in R, although for your purposes it would probably be easier to just roll your own (it's a very simple algorithm to code). This would also give you the flexibility of defining your own distance function, since you may decide that euclidean distance doesn't suit your needs, or you want to calculate distance differently for different dimensions.

To be more concrete about my suggestion, let's say you use 5-NN. For a particular user you want to get recommendations for, find the 5 nearest neighbors in your feature space. Collect all the purchases of those neighbors, ignoring items that your target user has already purchased. Recommend the items that are most popular among all neighbors, breaking ties using the global popularity of the items in the dataset.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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