HDSC Stage F OSP- Restaurant Revenue Prediction
By: Iwuozor John
Tags: Predictions, Regression, Hamoye Latest, Kaggle Competition, Hamoye Features

Introduction

Stage F of the Hamoye Data Science Internship brought about another different and exciting perspective as my team worked on a restaurant revenue dataset. We were required to analyze and build models to predict the annual revenues of different restaurants. Below is a link to the dataset https://www.kaggle.com/c/restaurant-revenue-prediction.

This competition was carried out six(6) years ago on Kaggle, and the winning team, Team Arsenal emerged with an RMSE score of 1,727,811.48553. My team worked on this dataset and got an RMSE score of 1,741,204.57557 which would have landed us in 5th position if the leaderboard were to be updated out of the 2257 teams that participated in the competition!

This project was a challenging one mostly due to the size and features of the training dataset involved. However, we were able to tackle it by carrying out different but somewhat similar kinds of feature engineering and modelling before arriving at the best performing model. The team members involved in this project include Oluwaseun Ilori(Project Lead), Oluwatosin Aina(Assistant Project Lead), Iwuozor John(Query Analyst), Williams Abodunrin, Miracle Osigwe, mukthar, and Samuel Adeapin.

Problem Statement

New restaurant sites require large investments of time and capital to be properly set up to run smoothly. When the wrong location for a restaurant brand is chosen, the site closes within 18 months and operating losses are incurred.

We are expected to find a mathematical model that will increase the effectiveness of investments in new restaurant sites, and will also allow Tab Food Investments(TFI) to invest more in other important business areas, like sustainability, innovation, and training for new employees. Using demographic, real estate, and commercial data, we would try to predict the annual restaurant sales of 100,000 regional locations.

Dataset Description

The dataset consists of a train set for training and fitting the model, and a test set for evaluating the model performance. The trained dataset has different data fields such as the date the restaurant was opened, city, city group(either big cities or other), type of restaurants, annual revenue, and 37 other columns that contain obfuscated data representing demographic data, real estate data, and commercial data. The trained set and test set have 137 and 100,000 entries respectively. The test set has similar characteristics to the train set, except the inclusion of the revenue column because we are expected to construct an ML model to predict that column.

Analyzing the Big Picture

Map showing the location and relative frequencies of restaurants opened in their respective locations.

From the map above, most of these restaurants are located in the region of Turkey. Hence, it is easy to deduce that the big cities contain the most restaurants, and by extension, the highest revenues as expected. Istanbul has the highest number of restaurants (50 restaurants), followed by Ankara(19 restaurants). The bar chart below also illustrates this:

‘FC’, ‘IL’, and ‘DT’ types refer to Food court, Inline, and Drive-through respectively. From the image above, Food court is the most popular type of restaurant, followed by Inline, while Drive-through is the least popular type.

Feature Engineering

The training dataset had 137 data points and this little size was a challenging factor when it came to modelling. It was very easy to overfit or underfit the model because there was not enough training set, so this called for a simple and robust model to fit and train the data. But before we carried out the modelling, we needed to inspect and scrutinize the given data.

After carrying out some initial exploratory data analysis(EDA), we observed that although the datasets did not have any missing values, there were some outliers that were present in the revenue column located in the train set.

The graph above indicated the presence of outliers, and those outliers were removed so that the model can get a better prediction.

We extracted some new features from the ‘Open Date’ column, such as the months the restaurants were opened, and the number of days they have been opened.

The number of restaurants plotted against the year they were opened

It was also necessary to carry out feature encoding of the categorical variables into numerical figures so that the machine learning algorithm would be able to tackle it.

Before modelling, we applied the StandardScaler() function to standardize the data i.e the data would be normalized in such a way that the distribution would be centered around 0, with a standard deviation of 1.