ajit2704 / RecoTour

A tour through recommendation algorithms in python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RecoTour

This repo intends to be a tour through some recommendation algorithms in python using various dataset. A companion Medium post can be found here.

At the moment the datasets included are:

  1. the Ponpare coupon dataset, which corresponds to a coupon purchase prediction competition at Kaggle (i.e. recommending coupons to customers).
  2. the Amazon Reviews dataset, in particular the 5-core Movies and TV reviews

Each of the two datasets is used to illustrate a set of different techniques, although I explored a wider range of techniques with the Ponpare dataset and the corresponding notebooks are, in general, more detailed.

The core of the repo are the notebooks in each directory. They intend to be self-contained and in consequence, there is some of code repetition. The code is, of course, "notebook-oriented". The notebooks have plenty of explanations and references to relevant papers or packages. My intention was to focus on the code, but you will also find some math.

All the code in the notebooks has run on a c5.4xlarge instance or a p2.xlarge instance when running deep learning algorithms.

This is what you will find in the notebooks:

Ponpare

  1. Data processing, with a deep dive into feature engineering
  2. Most Popular recommendations (the baseline)
  3. Item-User similarity based recommendations
  4. kNN Collaborative Filtering recommendations
  5. GBM based recommendations using lightGBM with a tutorial on how to optimize gbms
  6. Non-Negative Matrix Factorization recommendations
  7. Factorization Machines recommendations using xlearn
  8. Field Aware Factorization Machines recommendations using xlearn
  9. Deep Learning based recommendations (Wide and Deep) using pytorch

I have included a more modular (nicer looking) version of a possible final solution (described in Chapter16_final_solution_Recommendations.ipynb) in the directory final_recommendations.

In addition, I have included an illustration of how to use other evaluation metrics apart from the one shown in the notebooks ( the mean average precision or MAP) such as the Normalized Discounted Cumulative Gain (NDCG). This can be found in using_ncdg.py in the directory py_scripts.

Amazon

  1. Neural Collaborative Filtering

I hope the code here is useful to someone. If you have any idea on how to improve the content of the repo, or you want to contribute, let me know.

About

A tour through recommendation algorithms in python


Languages

Language:Jupyter Notebook 96.3%Language:Python 3.6%Language:Shell 0.1%