Solving Citi Bike's Rebalancing Problem


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