Data Science Solving Citi Bike's Rebalancing Problem

The skills I demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.

Data Science Introduction

As of 2020, the global bike sharing market was valued at 3 billion USD. Bike sharing attempts to solve the β€˜last mile’ of transportation by filling in the gaps of traditional public transportation methods like subways and buses. The benefits of bike sharing schemes include transport flexibility, reductions to vehicle emissions, health benefits, reduced congestion and fuel consumption, and financial savings for individuals.

The largest bike-share system in the United States is Citi Bike located in New York City. Citi Bike gained a monopoly to operate shared bikes in NYC (granted by NYC DOT) expiring in 2029 in exchange for making their per-ride data publicly available.

The goals of this project are:

  1. Understand Citi Bike’s rollout strategy for insights that can be used for a framework in other cities
  2. Understand general usage patterns
  3. Develop an ML model that can predict dock availability to be used in rebalancing strategy
  4. Develop a strategy for rebalancing bike system on top of what Citi Bike is already doing for rebalancing
  5. Create deployable app to share insights and rebalancing forecasting tool

Web App


(Warning: App is hosted on a free server and may take 30-60 seconds to load and is not formatted for mobile devices)


Rollout Strategy

  1. Based on the rollout data our hypothesis is Citi Bike prioritized the following when rolling out dock locations:
    Unofficial central business districts of Downtown Manhattan, Midtown Manhattan, Downtown Brooklyn, and Long Island City in order to cater to commuters
  2. High density residential areas
  3. Public transit hubs (subways and bus stops) in order to provide availability to and from final destination for users
  4. Maintain a continuously connected bike system at all times

Usage Patterns

Uptick in usage is around commuting hours during the week and afternoon hours during weekends.

Dock Availability Prediction Machine Learning Model

A Random Forest Regressor Model was developed to predict bike availability at each station. The model was trained on the last full year of data collected from May 1, 2018 - April 30, 2019. Features included in model were day and time, latitude and longitude coordinates, weather data, the number of docks and dock classification for each station. Stations were classified using a K-Means Model with distance to nearest central business district, distance to nearest subway, distance to nearest bus stop, borough, and zip code as features. The results for this model are listed below.

Train R^2 = 0.86
Test R^2 = 0.81

Due to lack of computing capacity, performing a sufficiently exhaustive grid search to tune hyperparameters was not feasible given time constraints. As such, the random forest model over fit the training data.

Rebalancing Algorithm

The Dock Availability Model predicts the bikes availability at each dock during an hour of the day . The rebalancing script uses the results of the dock availability predictions to locate the docks that are anticipated to become unbalanced. Low availability docks are sorted by descending quantity of bike deficit. High availability docks are sorted by descending quantity of bike surplus. A script is then used to iterate through both lists moving bikes until the imbalance is eliminated under the constraints specified by the user.

Excerpt of the rebalancing algorithm can be seen below.



About Authors

Hugh Goode

Hugh is a Data Scientist with a BS in Civil Engineering from the The College of New Jersey and an MS in Engineering Management from Duke University. After 5 years as an engineer, he pivoted to pursue Data...
View all posts by Hugh Goode >

Leave a Comment

No comments found.

View Posts by Categories

Our Recent Popular Posts

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 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 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 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