KatInterview

Multi-Horizon Dock Availability Prediction System

Machine LearningModel answer
HardModel answerMachine Learningtime-seriesforecastingfeature-engineering

Last updated

Design a real-time forecasting system to predict bike-share dock availability 24 hours ahead, handling temporal dependencies and asymmetric costs.

You're building a predictive system for a bike-sharing network. The system must forecast how many docks will be available at each station over the coming 24 hours, using historical snapshots captured every 15 minutes.

Available Data

Each observation includes:

  • timestamp: When the measurement was taken
  • station_id: Station identifier
  • available_docks: Count of empty docking spots at that moment
  • temp, humidity, precipitation: Weather conditions
  • is_holiday: Whether the day is a public holiday

Your Task

Design a forecasting solution that addresses:

  1. Feature design: How would you encode temporal patterns (daily cycles, weekly rhythms) and incorporate historical trends to improve predictions? What features capture the sequential nature of the problem?

  2. Data splitting: Explain your approach to creating train/validation splits that respect the temporal ordering and prevent information leakage from future data.

  3. Cost-sensitive prediction: The system should be more conservative about running out of capacity. Design a loss function that reflects higher penalties when the model underestimates availability (leading to full stations).

  4. Model selection: Recommend a modeling approach suited to this scenario. Consider that predictions must be generated quickly, stations influence each other geographically, and usage patterns evolve over time.

Operational Constraints

  • Predictions must be produced fast enough for real-time decision support
  • Station activity is correlated with nearby stations
  • Historical patterns shift due to seasonal changes and city growth

Hints

Hint 1

Start with a simple baseline like last-week-same-time before building complex models

Hint 2

All features must be knowable at prediction time—don't accidentally use future weather observations

Hint 3

Consider whether you're predicting each future step independently or recursively