This experiment demonstrates the use of the Matchbox recommender modules to train a restaurant recommendation engine.
# Recommender Modules In this tutorial, we will demonstrate a typical usage of Recommender modules in Azure Machine Learning studio. Recommenders are good for rating (predicting) similar items that users might like based on past habits and item characteristics. The recommendation algorithms are currently in use in website advertising on social media sites, all types of e-commerce sites, sponsored search results returned from search engines, and so on. In this experiment, we will train a recommender engine to recommend top restaurants to customers, then *score* restaurants based on the recommender engine with test data, and finally evaluate the recommender results. ## Data We use three datasets (Restaurant customer, Restaurant feature and Restaurant ratings) in this experiment. The datasets describes the restaurants, their customers, and the ratings they give. The datasets include both numerical and categorical features. Excerpt of each of the dataset is shown below. Restaurant Customer data has 19 attributes for 138 customers with each customer having a unique userID. ![image_customer] Restaurant data has 21 attributes for 130 restaurants with each restaurant having a unique placeID. ![image_restaurant] Restaurant Ratings data has 1161 customer ratings that customers (userID) provided for various restaurants (placeID). ![image_ratings] ## Experiment The rating data is contained in the Restaurant ratings dataset, which consists of user-item-rating triples. This dataset is split into a training and a test set. The training set is processed by the [Train Matchbox Recommender](http://help.azureml.net/Content/html/FA4AA69D-2F1C-4BA4-AD5F-90EA3A515B4C.htm) module. Predictions for the test set are made by the [Score Matchbox Recommender](http://help.azureml.net/Content/html/55544522-9A10-44BD-884F-9A91A9CEC2CD.htm) and then evaluated by the [Evaluate Recommender](http://help.azureml.net/Content/html/E9AD68A7-E91B-4AE6-800E-B5EE7E22CD17.htm) module. The _recommender prediction kind_ is set to "Item Recommendation" so the final output metric is NDCG (Nornalized Discounted Cumulative Gain). The trainer and the scorer also accept the optional user and item feature parameters. These are pre-processed by the [Project Columns](http://help.azureml.net/Content/html/1ec722fa-b623-4e26-a44e-a50c6d726223.htm) module to selects some of the relevant features. The following diagram shows the overall workflow of the experiment: ![image_experiment] The detailed settings of the each module is explained in the following sections. # Prepare Dataset First, we select the attributes from Restaurant customer and Restaurant feature datasets with **Project Columns** module. We selected _userID, latitude, longitude, interest_, and _personality_ from Restaurant customer dataset and selected _placeID, latitude, longitude_, and _price_ from Restaurant feature dataset. The details are shown below: ![image_project_column_customer] ![image_project_column_restaurant] Then we split the Restaurant Ratings dataset with **Split** module into training set and test set using _Recommender Split_ option. The details of the setting is shown below: ![image_split_ratings] # Train Matchbox Recommender The **Train Matchbox Recommender** module takes a traing set (part of Restaurant Ratings dataset) along with Restaurant customers attributes and Restaurant features as input and build a recommender engine. The settings of this module is shown below: ![image_train_matchbox_recommender] # Score Matchbox Recommender The **Score Matchbox Recommender** module takes in a test set (part of Restaurant Rating dataset) and trained model along with the Restaurant customer attributes and Restaurant features as input. We try to recommend restaurants for customers, so we chose _Item Recommendation_ option in _Recommender prediction kind_ field. Further, we like to use the scored results for evaluation, so we chose _From Rated Items (for model evaluation)_ in _Recommended item selection_ field. More details of these options can be found in the [module documentation](http://help.azureml.net/Content/html/55544522-9A10-44BD-884F-9A91A9CEC2CD.htm). The settings of this module is shown below: ![image_score_matchbox_recommender] # Evaluate Recommender The **Evaluate Recommender** takes the trained recommender model and score dataset (output from **Score Matchbox Recommender**) as input. The settings of this module is shown below: ![image_evaluate_recommender] # Results The evaluation results show that the restaurant recommender has NDCG score of 0.916511 on the test set. ![image_ndcg] <!-- Images --> [image_customer]:https://az712634.vo.msecnd.net/samplesimg/v1/S10/Customer.PNG [image_restaurant]:https://az712634.vo.msecnd.net/samplesimg/v1/S10/Restaurant.PNG [image_ratings]:https://az712634.vo.msecnd.net/samplesimg/v1/S10/Ratings.PNG [image_experiment]:https://az712634.vo.msecnd.net/samplesimg/v1/S10/Experiment.PNG [image_project_column_restaurant]:https://az712634.vo.msecnd.net/samplesimg/v1/S10/Project-Column-Restaurant.PNG [image_project_column_Customer]:https://az712634.vo.msecnd.net/samplesimg/v1/S10/Project-Column-Customer.PNG [image_split_ratings]:https://az712634.vo.msecnd.net/samplesimg/v1/S10/Split-Ratings.PNG [image_train_matchbox_recommender]:https://az712634.vo.msecnd.net/samplesimg/v1/S10/Train-Matchbox-Recommender.PNG [image_score_matchbox_recommender]:https://az712634.vo.msecnd.net/samplesimg/v1/S10/Score-Matchbox-Recommender.PNG [image_evaluate_recommender]:https://az712634.vo.msecnd.net/samplesimg/v1/S10/Evaluate-Recommender.PNG [image_ndcg]:https://az712634.vo.msecnd.net/samplesimg/v1/S10/NDCG.PNG