How to forecast bike dock demand
Two SigmaData Scientist · Technical ScreenLast updated
This problem tests your ability to design a predictive pipeline for spatio-temporal demand, focusing on feature extraction from time-series data and robust validation strategies.
Problem Statement
You are tasked with building a model to predict the hourly demand for bike-sharing docks at a specific station in a major city. The goal is to provide a forecast for the next 24 hours to help the operations team decide when to move bikes between stations.
You have access to the following data:
hourly_logs: A table containingtimestamp,station_id,num_bikes_available, andnum_docks_availablefor the past 2 years.weather_data: Historical hourly temperature, precipitation, and wind speed.calendar_data: Indicators for weekends, holidays, and local events (concerts, games).
Requirements
- Define the target variable: How would you structure the supervised learning problem given that the output is a continuous integer (number of bikes needed)?
- Feature Engineering: Propose 5 features that capture seasonality, trend, and external influence on bike usage.
- Validation: Explain how you would perform cross-validation for this time-series data to avoid data leakage.
- Model Choice: Choose a baseline model and a more complex model, justifying your selection.
Constraints
- The prediction must be granular (per station, per hour).
- Avoid "look-ahead" bias where future information accidentally leaks into training samples.
- The model must be robust to sudden spikes or drops in usage (e.g., sudden storms or station maintenance).
Hints
Hint 1
Consider transforming the raw counts into a change-in-demand variable or a delta to account for station capacity limits.
Hint 2
Use a sliding-window or 'rolling' cross-validation approach where the training set grows over time instead of standard K-fold cross-validation.
Hint 3
Think about lag features: historical demand at the same hour on the previous day or the previous week is often highly predictive.
Follow-up questions
- How would you handle cold-start issues for a newly installed bike station that has no historical data?
- If the model predicts demand correctly but the bikes cannot be moved fast enough due to traffic, how would you adjust the business objective?
- How would you monitor the model performance in production to detect concept drift caused by seasonal changes or new infrastructure?
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.