NYC Data Science Academy| Blog
Bootcamps
Lifetime Job Support Available Financing Available
Bootcamps
Data Science with Machine Learning Flagship ๐Ÿ† Data Analytics Bootcamp Artificial Intelligence Bootcamp New Release ๐ŸŽ‰
Free Lesson
Intro to Data Science New Release ๐ŸŽ‰
Find Inspiration
Find Alumni with Similar Background
Job Outlook
Occupational Outlook Graduate Outcomes Must See ๐Ÿ”ฅ
Alumni
Success Stories Testimonials Alumni Directory Alumni Exclusive Study Program
Courses
View Bundled Courses
Financing Available
Bootcamp Prep Popular ๐Ÿ”ฅ Data Science Mastery Data Science Launchpad with Python View AI Courses Generative AI for Everyone New ๐ŸŽ‰ Generative AI for Finance New ๐ŸŽ‰ Generative AI for Marketing New ๐ŸŽ‰
Bundle Up
Learn More and Save More
Combination of data science courses.
View Data Science Courses
Beginner
Introductory Python
Intermediate
Data Science Python: Data Analysis and Visualization Popular ๐Ÿ”ฅ Data Science R: Data Analysis and Visualization
Advanced
Data Science Python: Machine Learning Popular ๐Ÿ”ฅ Data Science R: Machine Learning Designing and Implementing Production MLOps New ๐ŸŽ‰ Natural Language Processing for Production (NLP) New ๐ŸŽ‰
Find Inspiration
Get Course Recommendation Must Try ๐Ÿ’Ž An Ultimate Guide to Become a Data Scientist
For Companies
For Companies
Corporate Offerings Hiring Partners Candidate Portfolio Hire Our Graduates
Students Work
Students Work
All Posts Capstone Data Visualization Machine Learning Python Projects R Projects
Tutorials
About
About
About Us Accreditation Contact Us Join Us FAQ Webinars Subscription An Ultimate Guide to
Become a Data Scientist
    Login
NYC Data Science Acedemy
Bootcamps
Courses
Students Work
About
Bootcamps
Bootcamps
Data Science with Machine Learning Flagship
Data Analytics Bootcamp
Artificial Intelligence Bootcamp New Release ๐ŸŽ‰
Free Lessons
Intro to Data Science New Release ๐ŸŽ‰
Find Inspiration
Find Alumni with Similar Background
Job Outlook
Occupational Outlook
Graduate Outcomes Must See ๐Ÿ”ฅ
Alumni
Success Stories
Testimonials
Alumni Directory
Alumni Exclusive Study Program
Courses
Bundles
financing available
View All Bundles
Bootcamp Prep
Data Science Mastery
Data Science Launchpad with Python NEW!
View AI Courses
Generative AI for Everyone
Generative AI for Finance
Generative AI for Marketing
View Data Science Courses
View All Professional Development Courses
Beginner
Introductory Python
Intermediate
Python: Data Analysis and Visualization
R: Data Analysis and Visualization
Advanced
Python: Machine Learning
R: Machine Learning
Designing and Implementing Production MLOps
Natural Language Processing for Production (NLP)
For Companies
Corporate Offerings
Hiring Partners
Candidate Portfolio
Hire Our Graduates
Students Work
All Posts
Capstone
Data Visualization
Machine Learning
Python Projects
R Projects
About
Accreditation
About Us
Contact Us
Join Us
FAQ
Webinars
Subscription
An Ultimate Guide to Become a Data Scientist
Tutorials
Data Analytics
  • Learn Pandas
  • Learn NumPy
  • Learn SciPy
  • Learn Matplotlib
Machine Learning
  • Boosting
  • Random Forest
  • Linear Regression
  • Decision Tree
  • PCA
Interview by Companies
  • JPMC
  • Google
  • Facebook
Artificial Intelligence
  • Learn Generative AI
  • Learn ChatGPT-3.5
  • Learn ChatGPT-4
  • Learn Google Bard
Coding
  • Learn Python
  • Learn SQL
  • Learn MySQL
  • Learn NoSQL
  • Learn PySpark
  • Learn PyTorch
Interview Questions
  • Python Hard
  • R Easy
  • R Hard
  • SQL Easy
  • SQL Hard
  • Python Easy
Data Science Blog > R Shiny > Dataset: Creating Accurate Pricing Model Based on UberEats

Dataset: Creating Accurate Pricing Model Based on UberEats

Robert Atuahene
Posted on May 17, 2020
The skills I demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.

 

Introduction                                                                                 

ShinyApp|LinkedIn

With the rich dataset gathered from the web scraping project, I decided to explore some of the features in the dataset and formulate a simple model to price restaurant sub-menus.  Due to the sheer size of the dataset(restaurant data for all cities in California consumed ~1/2 GB of my hard drive), I limited the work and analysis to cities in California. The analysis can be however extended to all cities in the US.

The basic question I seek to answer in this project is: Can I extract useful features from the UberEats site to create an accurate pricing model for sub-menus? 

The shinyApp contains the visuals that were useful in the exploratory data analysis as well as a prototype of the pricing model and its performance on a toy menu uploaded for illustrative purposes.

The intended audience would be a restaurant owner looking to introduce a new sub-menu item in a particular location and who needs a good gauge as to how to competitively price their menu from comparables.

Data:

As mentioned in the intro, the analysis was limited to the state of California. Dataset included 357 cities and 28k+ unique restaurants.  Main features scraped from UberEats are :

        • restaurant name and location
        • restaurant ratings
        • sub-menu items: dish names, prices and descriptions

First take:

Out of the 357 cities with a listed restaurant, Los Angeles was by far the most active city with ~4000 restaurants listed. Out of the ~24,000 sub-menus listed across the state, the most popular items were beverages(or soft drinks), sides, salads, desserts and sandwiches as shown below.

It can be seen from the above chart as well as the shinyApp that ~15% of the listed restaurants are found in Los Angeles alone. Still I wanted to explore the other cities and in particular the price distribution of their sub-menus. For this project, I limited the analysis to the top cities and top sub-menus as shown above.

City views:

After cutting off outliers and doing basic pre-processing of data to correct misspellings of sub-menu names and lump same sub-menu names with slight varying spellings together, I got the histograms and violin plots of prices for the sub-menus of the top 10 cities in California. The above is a snapshot for Los Angeles taken from the shinyApp with the drop down menu allowing users to select any of the other 9 cities used for this analysis.

Visually, same sub-menus showed similar price distributions across the cities. So I thought to myself, why not use the most actively listed city(Los Angeles) as the benchmark city and use the sub-menu prices in Los Angeles as the feature to predict like sub-menu prices in each of the other cities. That way we reduce the size of the data set drastically as we don't need to gather data from all cities to model sub-menu price ranges in each city.

Data Analysis

To do this though, I had to make an assumption that the sub-menu prices are drawn from the same distribution. To simplify the analysis, I assumed that their variances are the same and focused on analyzing the means of the sub-menu prices using a 2-sample t-test.  The null hypothesis here being: the mean of prices in the same sub-menu between Los Angeles and another city in California are the same.

For each 2-sample t-test if the null hypothesis cannot be rejected under the assumed confidence level then we can use the average price in Los Angeles to represent the average price in that city for that sub-menu. However if the null hypothesis is rejected then a transformation is made to adjust the mean of the sub-menu price in Los Angeles to match the mean of the sub-menu price in the actual data for the city being analyzed.

So are prices really different?

As mentioned above, I ran 2-sample t-tests for all top 10 cities with Los Angeles as the control city.  Testing means of sub-menu prices in Los Angeles against itself served as a test of the analysis. We expect that the means of all sub-menus in Los Angeles with itself to be the same as shown in the graph below:

 

dataset

However the means of same sub-menu items are expected to vary across different cities:

dataset

While I thought geographical proximity to Los Angeles would determine whether average prices were statistically similar or not, this does not appear to be the case at least for the top 10 cities included in the analysis and would be an interesting topic to explore further. Nonetheless, the results identify which sub-menu prices need to be transformed and which do not in our sub-menu pricing model.

What are ratings worth?

At this point, I've identified one feature to use in the pricing model - the mean of sub-menu prices in LA and for the other cities - a flag to determine which sub-menu prices need to be transformed based on the sub-menu, city combination.

One other potential feature is the restaurant rating. Most restaurants are reviewed and rated online by their customers and given the focus given to this by the industry, I wanted to find out if there was any significant correlation between the ratings and menu prices. If there is then we can successfully incorporate ratings into our pricing model.

Regression

Running a simple linear regression of mean prices against ratings shows significant regression beta for some cities especially Los Angeles and across the top 10 cities as a whole at the 95% confidence level:

dataset

dataset

So the good news is that there appears to be a linear relationship between ratings and prices even if the R-squared for the top 10 cities as a whole is fairly low. Ratings then gets to be included as the second feature in our model.

What else can we add to the model that's available to us from the scraped data?

Key words and prices?

I wanted to find out if certain words or phrases were common in higher priced meal items. Consequently I created a word cloud on meal descriptions after removing stop words and punctuation. Unfortunately, words and phrases that dominated were related to "party size" items on the menu. What I needed to do was to normalize prices by quantity to deduce the unit price of each meal.

I however do not have quantities in my scraped data and as such couldn't proceed further with this analysis. While keywords did not make it into the final pricing model, there's still information that can be gleaned from them. This warrants further investigation - something I intend to do using machine learning techniques as I pick them up along the course of this bootcamp.

dataset

 

Can I price your menu?

With knowledge of the distribution of average sub-menu prices relative to their equivalents in Los Angeles and how menu prices on average vary with restaurant ratings I created a simple linear model that accepts as input a table of sub-menu items, restaurant rating and location and outputs a range of prices for each sub-menu item as a recommendation for a restaurant owner looking to price such menu items. Model results were compared visually to those from the actual price ranges for those sub-menu items and restaurant's location as shown below:

dataset

The simple model didn't perform too well especially when it comes to sub-menu items with significant skew different from that seen in the equivalent price series from Los Angeles. This was expected as pricing assumptions ignored variances and skewness and focused solely on the 1st moment of the price distributions: mean and hence didn't have enough information to accurately model the price ranges for each of these sub-menus when they differed significantly from their equivalents in Los Angeles. More generally, more features will need to introduced in this model to improve accuracy.

Back to the Question

Coming back to my initial research question, there's isn't enough features from the scraped data to accurately price a restaurant's sub-menu item but this work serves as the building blocks for further more advanced work on this pricing topic. Further work will be heavy on feature generation and selection using sources outside uberEats' public website.  Features would then be fitted using multi-linear regression with penalization or non-linear regression techniques to ascertain the best pricing model given the data.

Stay tuned. 

About Author

Robert Atuahene

Financial services executive with extensive experience in trading and risk management of listed derivatives. Excited about opportunities to apply data science to the financial services domain and beyond!
View all posts by Robert Atuahene >

Leave a Comment

No comments found.

View Posts by Categories

All Posts 2399 posts
AI 7 posts
AI Agent 2 posts
AI-based hotel recommendation 1 posts
AIForGood 1 posts
Alumni 60 posts
Animated Maps 1 posts
APIs 41 posts
Artificial Intelligence 2 posts
Artificial Intelligence 2 posts
AWS 13 posts
Banking 1 posts
Big Data 50 posts
Branch Analysis 1 posts
Capstone 206 posts
Career Education 7 posts
CLIP 1 posts
Community 72 posts
Congestion Zone 1 posts
Content Recommendation 1 posts
Cosine SImilarity 1 posts
Data Analysis 5 posts
Data Engineering 1 posts
Data Engineering 3 posts
Data Science 7 posts
Data Science News and Sharing 73 posts
Data Visualization 324 posts
Events 5 posts
Featured 37 posts
Function calling 1 posts
FutureTech 1 posts
Generative AI 5 posts
Hadoop 13 posts
Image Classification 1 posts
Innovation 2 posts
Kmeans Cluster 1 posts
LLM 6 posts
Machine Learning 364 posts
Marketing 1 posts
Meetup 144 posts
MLOPs 1 posts
Model Deployment 1 posts
Nagamas69 1 posts
NLP 1 posts
OpenAI 5 posts
OpenNYC Data 1 posts
pySpark 1 posts
Python 16 posts
Python 458 posts
Python data analysis 4 posts
Python Shiny 2 posts
R 404 posts
R Data Analysis 1 posts
R Shiny 560 posts
R Visualization 445 posts
RAG 1 posts
RoBERTa 1 posts
semantic rearch 2 posts
Spark 17 posts
SQL 1 posts
Streamlit 2 posts
Student Works 1687 posts
Tableau 12 posts
TensorFlow 3 posts
Traffic 1 posts
User Preference Modeling 1 posts
Vector database 2 posts
Web Scraping 483 posts
wukong138 1 posts

Our Recent Popular Posts

AI 4 AI: ChatGPT Unifies My Blog Posts
by Vinod Chugani
Dec 18, 2022
Meet Your Machine Learning Mentors: Kyle Gallatin
by Vivian Zhang
Nov 4, 2020
NICU Admissions and CCHD: Predicting Based on Data Analysis
by Paul Lee, Aron Berke, Bee Kim, Bettina Meier and Ira Villar
Jan 7, 2020

View Posts by Tags

#python #trainwithnycdsa 2019 2020 Revenue 3-points agriculture air quality airbnb airline alcohol Alex Baransky algorithm alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus ames dataset ames housing dataset apartment rent API Application artist aws bank loans beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep boston safety Bundles cake recipe California Cancer Research capstone car price Career Career Day ChatGPT citibike classic cars classpass clustering Coding Course Demo Course Report covid 19 credit credit card crime frequency crops D3.js data data analysis Data Analyst data analytics data for tripadvisor reviews data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization database Deep Learning Demo Day Discount disney dplyr drug data e-commerce economy employee employee burnout employer networking environment feature engineering Finance Financial Data Science fitness studio Flask flight delay football gbm Get Hired ggplot2 googleVis H20 Hadoop hallmark holiday movie happiness healthcare frauds higgs boson Hiring hiring partner events Hiring Partners hotels housing housing data housing predictions housing price hy-vee Income industry Industry Experts Injuries Instructor Blog Instructor Interview insurance italki Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter las vegas airport lasso regression Lead Data Scienctist Lead Data Scientist leaflet league linear regression Logistic Regression machine learning Maps market matplotlib Medical Research Meet the team meetup methal health miami beach movie music Napoli NBA netflix Networking neural network Neural networks New Courses NHL nlp NYC NYC Data Science nyc data science academy NYC Open Data nyc property NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time performance phoenix pollutants Portfolio Development precision measurement prediction Prework Programming public safety PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R Data Analysis R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn seafood type Selenium sentiment analysis sentiment classification Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau teachers team team performance TensorFlow Testimonial tf-idf Top Data Science Bootcamp Top manufacturing companies Transfers tweets twitter videos visualization wallstreet wallstreetbets web scraping Weekend Course What to expect whiskey whiskeyadvocate wildfire word cloud word2vec XGBoost yelp youtube trending ZORI

NYC Data Science Academy

NYC Data Science Academy teaches data science, trains companies and their employees to better profit from data, excels at big data project consulting, and connects trained Data Scientists to our industry.

NYC Data Science Academy is licensed by New York State Education Department.

Get detailed curriculum information about our
amazing bootcamp!

Please enter a valid email address
Sign up completed. Thank you!

Offerings

  • HOME
  • DATA SCIENCE BOOTCAMP
  • ONLINE DATA SCIENCE BOOTCAMP
  • Professional Development Courses
  • CORPORATE OFFERINGS
  • HIRING PARTNERS
  • About

  • About Us
  • Alumni
  • Blog
  • FAQ
  • Contact Us
  • Refund Policy
  • Join Us
  • SOCIAL MEDIA

    ยฉ 2025 NYC Data Science Academy
    All rights reserved. | Site Map
    Privacy Policy | Terms of Service
    Bootcamp Application