Engineering Time and Location Features for Rider Demand Forecasting

Last updated: November 29, 2026

Quick Overview

You need to forecast ride requests per hexagon per 15 minute window for the next hour. What features would you build from time and location, and how do you avoid leakage?

Uber
Machine Learning
Machine Learning Engineer
Uber
November 29, 2026
Machine Learning Engineer
Onsite
Machine Learning
Medium

0

0

0 solved


You need to forecast ride requests per hexagon per 15 minute window for the next hour. What features would you build from time and location, and how do you avoid leakage?

Demand forecasts drive surge, driver positioning nudges and incentives at Uber, and the H3 hexagon grid is the standard spatial unit. The interviewer checks that you can encode cyclic time, spatial neighbors and recent history without peeking at the future.

What the Interviewer Expects
  • Encode cyclic time with sine and cosine or learned embeddings
  • Use lag and rolling features only from data available at prediction time
  • Add spatial context from neighboring hexagons
  • Include calendar and event signals (holidays, concerts, weather)
  • Explain how to handle sparse low-volume hexagons
Key Topics to Cover
cyclic encoding
lag features
H3 spatial features
leakage
target encoding
How to Approach This
  1. Understand the bias-variance trade-off. High training accuracy but low test accuracy signals overfitting.
  2. Choose evaluation metrics carefully based on the problem. Accuracy alone is often insufficient.
  3. Feature engineering is often more impactful than model selection.
  4. Know when to use tree-based models (tabular data) vs neural networks (unstructured data).
  5. Handle class imbalance with SMOTE, class weights, or appropriate loss functions.
Possible Follow-up Questions
  • How would you represent a hexagon ID for a tree model versus a neural net?
  • What changes for a city you just launched with two weeks of data?
  • How do you validate a forecasting model honestly?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Explore ML Interview Prep
Sample Answer
Clarify

Prediction is made at time tt for windows t+15t+15 to t+60t+60 minutes. Any feature must be computable from data with timestamp at or before tt, with realistic pipeline delay (say the last 2 minutes of ...

Approach

Group features into four families.

Time. Hour of day and day of week as cyclic pairs: sin⁡(2πh/24)\sin(2\pi h/24), cos⁡(2πh/24)\cos(2\pi h/24), so 23:45 is close to 00:00. Holiday flags, days to payday, school term ...


Submit Your Answer
Markdown supported