Restaurant Recommendation System with Python

Machine Learning project on Restaurant Recommendation System with Python.

In this article, I will introduce you to a machine learning project on Restaurant Recommendation System with Python programming language. There is an extended class of applications that involve predicting user responses to a variety of options. Such a system is called a recommender system.

How the Restaurant Recommendation System Works?

The rapid growth in data collection has led to a new era of a data-driven world. Data is used to create more efficient systems and that’s where recommender systems come in.

Also, Read – 100+ Machine Learning Projects Solved and Explained.

Recommendation systems are a type of information filtering systems because they improve the quality of search results and provide elements that are more relevant to the search item or that are related to the search history of the user.

These are active information filtering systems that personalize the information provided to a user based on their interests, relevance of the information, etc. Recommendation systems are widely used to recommend movies, items, restaurants, places to visit, items to buy, etc.

There are two types of recommendation systems:

  1. Content-based filtering
  2. Collaborative filtering
Zomato Recommendation System

A Restaurant recommendation system uses content-based filtering. This method only uses information about the description and attributes of items that users have previously consumed to model user preferences.

In other words, these algorithms try to recommend things similar to what a user liked in the past. The dataset I’ll be using here consists of restaurants in Bangalore, India, collected from Zomato. You can download the dataset from here.

To create the Restaurant recommendation system, I will create a content-based recommendation system where when I enter the name of a restaurant, the Restaurant recommendation system will look at reviews from other restaurants, and System will recommend us to the other restaurants with similar reviews and sort them from the top-rated.

Machine Learning Project on Restaurant Recommendation System with Python

I will start the task of Restaurant Recommendation System by importing the necessary Python Libraries:

Now, I will load and read the dataset:

zomato_real=pd.read_csv("zomato.csv")
zomato_real.head() # prints the first 5 rows of the dataset

Now the next step is data cleaning and feature engineering for this step we need to do a lot of stuff with the data such as:

  1. Deleting Unnecessary Columns
  2. Removing the Duplicates
  3. Remove the NaN values from the dataset
  4. Changing the column names
  5. Data Transformations
  6. Data Cleaning
  7. Adjust the column names

Now, let’s perform all the above steps in our data:

Now the next step is to perform some text preprocessing steps which include:

  1. Lower casing
  2. Removal of Punctuations
  3. Removal of Stopwords
  4. Removal of URLs
  5. Spelling correction

Now let’s perform the above text preprocessing steps on the data:

reviews_listcuisines
12110rated 20 ratedn piece shit customer service wo…Ice Cream, Desserts
25865rated 10 ratedn ordered chicken fried rice chi…Bengali, North Indian, Chinese
555rated 40 ratedn perfect place burger coke frie…Burger, Fast Food
14033rated 40 ratedn place needs introduction locat…Bakery, Cafe, Italian, Desserts
37162rated 50 ratedn located city market cant miss …Healthy Food, Juices

TF-IDF Vectorization

TF-IDF (Term Frequency-Inverse Document Frequency) vectors for each document. This will give you a matrix where each column represents a word in the general vocabulary (all words that appear in at least one document) and each column represents a restaurant, as before.

TF-IDF is the statistical method of assessing the meaning of a word in a given document. Now, I will use the TF-IDF vectorization on the dataset:

Now the last step for creating a Restaurant Recommendation System is to write a function that will recommend restaurants:

cuisinesMean Ratingcost
CinnamonNorth Indian, Chinese, Biryani3.62550.0
Prasiddhi Food CornerFast Food, North Indian, South Indian3.45200.0
Shrusti CoffeeCafe, South Indian3.45150.0
Shanthi SagarSouth Indian, North Indian, Chinese3.44400.0
Shanthi SagarSouth Indian, North Indian, Chinese, Juices3.44250.0
Mayura SagarChinese, North Indian, South Indian3.32250.0
Container CoffeeSouth Indian3.11200.0

As as you can see that we got a fairly good output. So, I hope you liked this article on Machine Learning project on Restaurant Recommendation system with Python programming language. Feel free to ask your valuable questions in the comments section below.

Default image
Aman Kharwal

I am a programmer from India, and I am here to guide you with Data Science, Machine Learning, Python, and C++ for free. I hope you will learn a lot in your journey towards Coding, Machine Learning and Artificial Intelligence with me.

Leave a Reply