Uber Optimization: Finding Passengers Faster

Posted on May 8, 2018


Ridesharing drivers and companies, such as Uber and Lyft, can make more money by filling their cars with passengers for a higher percentage of the time they are on the road. With this in mind, I designed a Shiny app for New York City rideshare drivers that recommends a destination at which they will likely find passengers faster. The recommendation is based on the user's current location, time, day of the week and the temperature in NYC.


In 2015, the news and analytics website FiveThirtyEight obtained historical Uber pickups in NYC from the NYC Taxi & Limousine Commission by filing a Freedom of Information Law request. From this data set I used pickups from April - September 2014, as they included GPS coordinates. I supplemented this data set with hourly weather data from NOAA, the National Weather Service Forecast Office.

To review my dataset and code: Github

Visualization and Recommendation

After cleaning and merging the data, I plotted each pickup using Leaflet clusters. I added filters so the user can manually limit pickups to those made under specific temperatures, days of the week and times of day. In order to give drivers some insight over time, I added a histogram below the map showing pickups overtime across the city based on the users filter criteria.

The map responds to a user's click, collecting the GPS coordinates at their indicated starting point. I used google's revgeocode function to convert these GPS coordinates into the associated address. Next, I used the function distm to create a new dataset containing all pickups under the user's selected criteria within a quarter mile radius (as the crow flies) of the selected starting point. In this new dataset (in which each row contains the GPS coordinates of one specific pickup) I added a column with the total number of other pickups in the dataset within a tenth of a mile radius of each respective pickup. I then calculated the row with the maximum value in that column (indicating a high density of other surrounding pickups) and selected the GPS coordinates in that row as the end destination. Finally, I used the function gmapsdistance (Google Maps distance matrix API) to output the time and distance from the starting click point to the ending destination.

Give it a try yourself here: ShinyApp.io



Future Work

There is a lot more work to be done to improve the quality of the recommendation in my app. I would filter my data using SQLite in order to improve the speed of my app. This would allow me to incorporate all 5.3 million pickups from the original Uber dataset (I had to take a subset to get it to run smoothly in the demo). Additionally, I would add NYC taxi data in order to have data year-round (Uber only released April - Sept. pickups). This would allow me to expand the weather data filter as variables such as rain, snow and humidity would become more meaningful. I would also factor in events occurring across the city that drive rideshare demand. Finally, I would implement predictive analytics and recommendations for drivers, such as route and time optimization, using machine learning.

About Author

Bennett Gelly

Bennett is a data science fellow at NYCDSA and an MBA candidate at Columbia Business School. He is interested in machine learning-driven business strategy. Bennett brings substantial financial modeling and analytics skills from prior employment in equity research...
View all posts by Bennett Gelly >

Related Articles

Leave a Comment

No comments found.

View Posts by Categories

Our Recent Popular Posts

View Posts by Tags

#python #trainwithnycdsa 2019 airbnb Alex Baransky alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus API Application artist aws 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 Bundles California Cancer Research capstone Career Career Day citibike clustering Coding Course Demo Course Report D3.js data Data Analyst data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization Deep Learning Demo Day Discount dplyr employer networking feature engineering Finance Financial Data Science Flask gbm Get Hired ggplot2 googleVis Hadoop higgs boson Hiring hiring partner events Hiring Partners Industry Experts Instructor Blog Instructor Interview Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter lasso regression Lead Data Scienctist Lead Data Scientist leaflet linear regression Logistic Regression machine learning Maps matplotlib Medical Research Meet the team meetup Networking neural network Neural networks New Courses nlp NYC NYC Data Science nyc data science academy NYC Open Data NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time Portfolio Development prediction Prework Programming PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R 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 Selenium sentiment analysis Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau team TensorFlow Testimonial tf-idf Top Data Science Bootcamp twitter visualization web scraping Weekend Course What to expect word cloud word2vec XGBoost yelp