KatInterview

Predicting Station-Level Micro-Mobility Checkout Demand

Machine LearningModel answer
HardModel answerMachine Learningmachine-learningtime-seriesdemand-forecasting

Last updated

Architect an end-to-end machine learning pipeline to forecast hourly bike-sharing demand, covering censoring adjustments, spatial-temporal features, model selection, and backtesting.

You are asked to design a production-grade machine learning pipeline to predict hourly bike checkout demand at individual docking stations across a major metropolitan bike-share network. Operations teams rely on these predictions to route rebalancing vans and prevent stockouts (empty docks) and oversupplies (full docks).

Available Datasets

  1. Trip Activity Logs: trip_id, start_station_id, end_station_id, start_time, end_time.
  2. Station Metadata: station_id, capacity, latitude, longitude, elevation, install_date.
  3. Exogenous Features: Weather forecasts and historical observations (temperature, rain, wind speed), municipal calendar (holidays, events), and public transportation service disruptions.

Expected Deliverables

  1. Pipeline Architecture & Demand Censoring: Explain how to process raw trip logs into a structured temporal panel. Detail how you will handle censored demand caused by stockouts where observed pickups drop due to lack of supply rather than lack of interest.
  2. Feature Engineering Strategy: Detail your feature matrix, focusing on cyclic seasonality, spatial proximity, and external signals. Address how to prevent target leakage when integrating weather data into a real-time system.
  3. Model Selection & Architecture Trade-Offs: Compare a global gradient-boosted decision tree framework against a spatio-temporal deep learning architecture (e.g., Graph Neural Networks paired with Temporal Fusion Transformers). Discuss interpretability, operational overhead, and loss formulations suitable for count data.
  4. Validation Framework & Metrics: Design a validation strategy that accounts for temporal dependencies. Select appropriate evaluation metrics and explain how to evaluate performance across low-volume or highly intermittent fringe stations.

Hints

Hint 1

Observed trip starts only measure realized usage, not total potential demand. Consider how to adjust for hours when inventory was zero.

Hint 2

Operational models predicting future hours must be trained on weather predictions available prior to inference time, rather than post-hoc actual weather recordings.

Hint 3

Random cross-validation breaks time order and leaks target information via lag and rolling window features. Use walk-forward backtesting splits.