Data,

Intelligence

&

Magic

Predicting the demand for BIXI bikes during an hour of the day

Published on 03-Jan-2022

Author: Nirmal Prasad

BIXI is a bicycle sharing system operational in Montreal, Canada since 2009. Users can rent bikes at bike docking stations for short commutes in the city. It is a convenient way to ride bikes as users can rent a bike from a station, ride up to their destination and drop off the bike at the nearest docking station. There is a usage fee based on the duration of the trip and there are options in the form of monthly & seasonal memberships as well.

The data science problem discussed here is about predicting the demand for BIXI bikes on any given hour of the day. The problem was a business case to be solved as part of the course 'Data Science for Business Decisions' offered by McGill University, Montreal.

The data used for the analysis was generated in the year 2018 & is available for download from the website of BIXI. It is believed that week-days & weekends have two distinct demand patterns and weather is also a factor that affects demand. The weather data for the analysis was obtained from the Government of Canada website and it is assumed that the whole of Montreal have the same weather condition as what was observed at McTavish reservoir station, which is near the McGill University.

There are two objectives for this data science project. Firstly, visualization of the demand patterns on week-days & week-ends which is accomplished using Tableau. Secondly, to build a predictive model that allows BIXI to predict the demand of bikes by hour of the day. This is achieved using Alteryx.


The chart of week-day clearly shows the two peak hours of demand during the day - 8th & 17th. The average number of rides during an hour of a week-day is 32,842.

The following image shows the chart of week-end & it has only one peak at 16th hour. The average number of rides during an hour of a week-end is 27,844.

The above visualizations were created by combining the transaction data for the months April-2018 to November-2018. In order to create a predictive model to predict the demand for bixi bikes, the transaction data was combined with the weather data of Montreal. For the modelling, the month, day & hour of the bixi transactions were used in conjunction with the temperature & relative humidity of the hour to create a Decision Tree model.

This model has a R-squared value of 0.925 and a root mean squared error(RMSE) of 238.407 on the evaluation sample and a RMSE of 300.634 on the validation sample.

Code repository

All the necessary workbooks and code of this project is available in the below GitHub repository.

bixi_demand_analysis.git