Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Send More Riders
Search
peteowlett
February 02, 2016
Technology
4
910
Send More Riders
Predictive scheduling for an on demand delivery fleet
peteowlett
February 02, 2016
Tweet
Share
More Decks by peteowlett
See All by peteowlett
Lessons from 6 Months of using Luigi
peteowlett
4
860
Takeaway Tales
peteowlett
1
180
Other Decks in Technology
See All in Technology
OCI Network Firewall 概要
oracle4engineer
PRO
0
4.1k
Can We Measure Developer Productivity?
ewolff
1
150
IBC 2024 動画技術関連レポート / IBC 2024 Report
cyberagentdevelopers
PRO
0
110
Platform Engineering for Software Developers and Architects
syntasso
1
510
信頼性に挑む中で拡張できる・得られる1人のスキルセットとは?
ken5scal
2
530
個人でもIAM Identity Centerを使おう!(アクセス管理編)
ryder472
3
200
エンジニア人生の拡張性を高める 「探索型キャリア設計」の提案
tenshoku_draft
1
120
iOSチームとAndroidチームでブランチ運用が違ったので整理してます
sansantech
PRO
0
130
ノーコードデータ分析ツールで体験する時系列データ分析超入門
negi111111
0
410
TypeScriptの次なる大進化なるか!? 条件型を返り値とする関数の型推論
uhyo
2
1.6k
SREによる隣接領域への越境とその先の信頼性
shonansurvivors
2
510
B2B SaaSから見た最近のC#/.NETの進化
sansantech
PRO
0
720
Featured
See All Featured
Building Your Own Lightsaber
phodgson
103
6.1k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Typedesign – Prime Four
hannesfritz
40
2.4k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
Intergalactic Javascript Robots from Outer Space
tanoku
269
27k
The Pragmatic Product Professional
lauravandoore
31
6.3k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
506
140k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
What's in a price? How to price your products and services
michaelherold
243
12k
Designing for Performance
lara
604
68k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
Transcript
Send More Riders! Predictive scheduling for an on demand delivery
fleet @PeterOwlett
High quality food, delivered fast and on demand
None
Life of an order
Life of an order
Utilisation % Hour of Day (Colour = Day of Week)
We need enough drivers to deliver on time, but not
so many we lose money
•Restaurants take longer than expected to make food •Items get
missed - we have to go back and get them •Drivers become unavailable (flat tyre etc) •Customers hard to find It gets harder …
Exam question How many drivers should we schedule for the
next two weeks in each part of London over 15 minute blocks?
Before we dive in - a quick apology
Lets formulate! Where • O is orders • d is
date • z is zone
Forecasting Daily Volume
This book is awesome And Free!!! - https://www.otexts.org/fpp
Forecasting Daily Volume
None
Statsmodels supports this out of the box Forecasting Daily Volume
# Decompose the raw time series decomposition = sm.tsa.seasonal_decompose(data.values, freq=7) # Extract individual components all_trend = decomposition.trend all_seasonal = decomposition.seasonal all_resid = decomposition.resid
First Results
Holidays (and Weather) Forecasting Daily Volume
Improving the seasonal 50% Improvement!
•Vary the training range •Train on np.log(series) and transform back
Signal in the noise? Looks Seasonal Looks Seasonal Random Noise
Because we can chart each series, we can reason about
how to improve our model
Forecast each component Forecasting Daily Volume # Forecast Trend lm_lin
= LinearRegression().fit(dates, trend_vals) forecast_trend = lm_lin.predict(forecast_window) # Forecast Seasonal seasonal_pattern = np.tile(base_seasonal_pattern, math.ceil(days_to_forecast / 7.0)) forecast_seasonal = seasonal_pattern[0: days_to_forecast]
Forecasting Daily Volume
Where • O is orders • D is demand •
E is efficiency • z is zone • d is date • w is weekday • t is time of day Converting Daily Orders to Driver Hours
Zero to One Scale - neat trick Estimating Demand Curves
scaled_series = df_mean_curves.order_volume / df_mean_curves.groupby(['zone', ‘day_of_week’])\ .transform(np.sum).order_volume
Estimating Demand Curves Ratio of daily orders per unit time
Hour of Day
Efficiency Orders per driver per hour Hour of Day
Final Forecast
Getting the forecast out into the real world
Volumes to Shifts
Deployment
SUCCESS!!!
1. While not as powerful as R, Statsmodels does give
you core time series tools 2. Seasonal decomposition is very meaningful to human beings 3. By using all python, we were able to ship quickly Stuff we learned
Thanks!