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:
- Understand Citi Bike’s rollout strategy for insights that can be used for a framework in other cities
- Understand general usage patterns
- Develop an ML model that can predict dock availability to be used in rebalancing strategy
- Develop a strategy for rebalancing bike system on top of what Citi Bike is already doing for rebalancing
- Create deployable app to share insights and rebalancing forecasting tool
(Warning: App is hosted on a free server and may take 30-60 seconds to load and is not formatted for mobile devices)
- 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
- High density residential areas
- Public transit hubs (subways and bus stops) in order to provide availability to and from final destination for users
- Maintain a continuously connected bike system at all times
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.
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.