Stockout-aware demand forecasting and rebalancing for Citi Bike stations

A rebalancing planner for New York's Citi Bike: hourly station demand forecasts corrected for times a station was empty or full, turned into target bike levels and truck moves, shown on the live state of the network.

Background

New York's Citi Bike riders don't spread themselves evenly. They ride downhill, into Midtown in the morning and back out in the evening, so stations empty and fill in predictable waves. Every day, trucks and bike trailers move bikes back to where riders will want them.

Deciding those moves starts with a forecast, and the forecast has a blind spot. When a station is empty, the riders who wanted a bike there simply don't appear in the records. A model trained on trips alone learns that nobody rides from the stations that run out most, which is exactly backwards.

This planner forecasts station demand with that blind spot corrected, and turns the forecast into rebalancing moves.

Data

Citi Bike's public trip records, every ride since 2013 with its start and end station, time, bike type and rider type, plus the live feed of bikes and docks at every station. The feed is saved every five minutes to build a record of when stations were empty or full.

How it works

  • Hidden demand. Hours when a station was empty or full are identified, and demand for them is estimated from comparable hours when it was in service. The estimate is tested by hiding hours that were actually observed.
  • Forecasting. Seasonal rules, LightGBM and Chronos-2 forecast each station's departures and arrivals for the next day, with intervals.
  • Target levels. For each station, how many bikes it should start a period with to keep the chance of running empty or full low.
  • Truck moves. A routing model moves bikes from stations with too many to stations with too few, within truck capacity and crew hours.

Evaluation

Forecasts are backtested from many past dates, with and without the hidden-demand correction. Rebalancing plans are replayed against what riders actually did, counting how many would have found an empty or full station.

Demo

The network as it is right now: every station's bikes and docks, its chance of running empty or full in the next few hours, and the moves the planner recommends for the trucks available. The map outlines Manhattan's congestion charge zone; whether the charge moved trips onto bikes there is measured in the NYC congestion pricing project, and the forecasts here are trained across it.

Recovered demand is an estimate: riders who found an empty station may have walked to the next one, so some of it is moved demand rather than lost demand.