Order Forecasting on a Map Using a Single Time Series

Mikhail Kandryukov28 Oct 2023

Problem

A delivery company plans courier shifts with a ready service that takes delivery addresses and time intervals and returns the number of couriers needed. On the day of the shift it can ask for more couriers than the company has. Outsourced couriers then cost 3 times more. Outsourcing is cheapest about a week before the shift, and two weeks ahead the company can still reshuffle its own staff. But then most orders are unknown, and pickup requests can be placed until 3 PM on the day.

Example from the article: CDEK needed a two-week forecast of delivery points for a courier base, in a form the existing courier-assignment service accepts.

Solution in brief

Forecast the daily order count for the whole city as one series with a stacking ensemble and calendar regressors. Then draw that many points by resampling real historical orders, and add them to the points already known for the shift. The assignment service's courier counts on real and forecast points serve as the business metric.

Questions this case answers
  • How to forecast daily demand for a territory whose boundaries change often, and turn the forecast into concrete points that always fall on real historical locations
  • How to plan staffing two weeks ahead when most of the demand is not yet observed and the forecast must feed an external assignment service
  • How to forecast the number of orders per city and turn it into points on a map
  • How to plan courier shifts two weeks ahead when most orders are not yet placed

Tools and methods

  • ETNA StackingEnsemble — exponential smoothing, Prophet and per-segment linear model, combined by a quantile regressor.
  • Bootstrap of historical points — generates map points for the forecast count.
  • Heatmap grid — alternative point generation, not built in the MVP.
  • PostGIS — courier territory polygons, in a separate service.
  • Entropy, KL divergence, courier difference — candidate quality metrics for generated points.
Continue reading — it's free

Google or a one-time email code. No password.