KatInterview

Forecasting Hourly Rentals at a Single Bike-Share Dock Station

Machine LearningModel answer
HardModel answerMachine Learningtime-seriesforecastingcensored-data

Last updated

Design an end-to-end model that forecasts hourly bike pickups at one docked station for the next 24 hours, covering target definition, features, models, and evaluation.

A city bike-share operator lets riders take a bike from one docked station and return it to another. The operations team wants to decide how many bikes to leave at each station overnight, and you are asked to build a model that predicts demand, meaning the number of bike pickups, at one particular station.

Describe end to end how you would:

  1. Frame the prediction problem and define the target.
  2. Choose data sources and features.
  3. Select and compare models.
  4. Evaluate whether the model is trustworthy enough to drive stocking decisions.

Available data and assumptions

  • Several years of historical trip records, each with start and end station and start and end timestamps.
  • Weather observations and weather forecasts, plus calendar data such as holidays and day of week, can be joined in.
  • Unless told otherwise, assume the need is an hourly pickup forecast for the next 24 hours, refreshed at least once a day, to plan overnight rebalancing.
  • The model targets one station, but data from other stations may be used for features or extra training signal.

Questions worth raising with the interviewer

  • Which decision does the forecast drive (rebalancing trucks, dock sizing, pricing)? This sets the horizon, granularity, and which errors cost the most.
  • Is demand pickups only, or also dropoffs and net flow?
  • Is the target observed pickups, or true demand corrected for hours when the station had no bikes?
  • How far ahead, and how often refreshed?
  • Is under-forecasting costlier than over-forecasting, so that quantiles are needed instead of a point estimate?
  • Is this a one-off station, or a pilot for the whole network?

Hints

Hint 1

Observed pickups are capped by how many bikes were physically there. Think about what the logs show during hours when the station was empty, and what that does to a model trained on raw counts.

Hint 2

Every feature must be known at the moment the forecast is issued. For a 24-hour horizon issued in the evening, a 'last hour' lag is not available for tomorrow afternoon, and weather should come from forecasts, not observations.

Hint 3

Start with a seasonal-naive baseline (same hour last week), then a count-based GLM, then gradient-boosted trees. Evaluate with rolling-origin backtests, metrics relative to the baseline, and a replay of the stocking decision rather than a single aggregate error number.