SlideShare una empresa de Scribd logo
1 de 27
Descargar para leer sin conexión
Productionalizing
Machine Learning Models:
Good, Bad and Ugly
Irina Kukuyeva, Ph.D.
SoCal PyData
April 26, 2018
2
Fashion
Consulting
IoT
Healthcare
Media & Entertainment
Finance
CPG
Retail
Video Game Publisher
Online Advertising
Healthcare
Ph.D.
My Background
3
Spectrum of (Select) Production Environments
Love, love, love
leather/faux leather
jackets! Especially the
blue!
Positive sentiment
Fashion
Customer Retention
Near-real time
Consulting
Revenue $3M+/year
ASAP
Online Advertising*
Revenue $1M+/year
Near-real time
Finance
Automation
Daily
What ML Model Lifecycle Really Looks Like
what customer
described
what data
looked like
what DS
began to build
what budget
could buy
what pivot
looked like
what code
got reused
what got
tested [1]
what got
pushed to prod
what got
documented
what customer
wanted
4
Agenda
what customer
described
what data
looked like
what DS
began to build
what budget
could buy
what pivot
looked like
what code
got reused
what got
tested
what got
pushed to prod
what got
documented
Step 1
(Appendix)
what customer
wanted
Step 2:
Data QA
(Other Talks)
Step 3:
ML
Development
(Other Talks)
Step 4:
Pre-prod
Step 5:
Prod
Step 5:
Prod
Step 1
(Appendix)
5
Step 4:
Pre-prod
[1]
Step 4: Pre-Production
6
7
Pre-Production: Pay Down Tech Debt
Technical Debt — Borrowing against future to trade-off between quality of
code and speed of delivery now [2], [3]
• Incur debt: write code, including ML pipelines [4], [21]
• Pay down debt: extensively test and refactor pipeline end-to-end
[5]
→ Test 1: Joel’s Test: 12 Steps to Better Code [6]
• Spec?
• Source control? Best practices? [7]
• One-step build? Daily builds? CI?
• Bug database? Release schedule? QA?
• Fix bugs before write new code?
8
Pre-Production: Pay Down Tech Debt
[8]
9
Consulting
Daily stand-up
Sprint planning
Version control*
Fix bugs first
Bugs emailed/db
Release on bugfix
One-step build
Atlassian suite
Virtual machines
Test 1: Joel’s Test: 12 Steps to Better Code … in practice:
Pre-Production: Pay Down Tech Debt
Fashion
Weekly stand-up
—
Version control
Fix bugs first
—
Release on bugfix
One-step build
PRD, Trello
Virtual env, Docker,
CircleCI, cookiecutter
Online Advertising*
Daily stand-up
Sprint planning
—
—
Bug database
—
—
—
—
Finance
—
—
Version control*
Fix bugs first
—
—
One-step build
Trello
—
10
Pre-Production: Pay Down Tech Debt
Test 1: Joel’s Test: 12 Steps to Better Code … in practice:
→ Test 2: ML Test Score [9], [10]
• Data and feature quality
• Model development
• ML infrastructure
• Monitoring ML
11
Pre-Production: Pay Down Tech Debt
[11]
12
→ Other tips — ML:
• Choose simplest model, most appropriate for task and prod env
• Test model against (simulated) “ground truth” or 2nd implementation [12]
• Evaluate effects of floating point [12]
• Model validation beyond AUC [13]
Pre-Production: Pay Down Tech Debt
→ Other tips — Code:
• What is the production environment?
• Set-up logging
• Add else to if or try/except + error
• DRY → refactor
• Add regression tests
• Comment liberally (explain “why”) + up-to-date [20]
• Lint
Pre-Production: Pay Down Tech Debt
[14]
13
Consulting
Minimal time to add new
feature
Unsuitable features
excluded
Test 2: ML Test Score … in practice:
– Data and Feature Quality –
Pre-Production: Pay Down Tech Debt
– Model Development –
Baseline model
Bias correction
Proxy + actual metrics
Simulated ground truthBaseline model + 2nd
implementation
Rolling refresh
Performance overall + those
most likely to click
Proxy + actual metrics
Code review (PR)
Hyperparameter
optimization
(sklearn.GridSearchCV)
14
Online Advertising* Fashion
Test input features
(typing, pytest)
Finance
Minimal time to add
new feature
Privacy built-in
Consulting
Loosely coupled fcns
Central repo for clients
Regression testing
One-step build, prod
Pre-Production: Pay Down Tech Debt
Missing data check
Logging
Software + package
versions check
Data availability check
Logging (logging)
Evaluates empty +
factual responses
Local = prod env
(virtualenv, Docker)
Comp time (timeit)
15
Online Advertising*
Streaming
Fashion
Loosely coupled fcns
Streaming API (sanic)
Integration test (pytest)
One-step build, prod
Finance
Loosely coupled fcns
Streaming
One-step build, prod*
Reproducibility of training
Test 2: ML Test Score … in practice:
– ML Infrastructure –
– ML Monitoring –
16
Test 2: ML Test Score … in practice (cont’d):
Pre-Production: Pay Down Tech Debt
Step 5: Production
17
18
Production: Deploy Code and Monitor Performance
→ One-button push to prod branch/repo
→ Model Rollout
→ Monitoring
[15]
Step 6: Post-Production
19
20
→ Documentation + QA
→ Debugging, debugging, debugging
→ Bugfix vs. Feature
→ Container Management
→ Post-mortem
→ Use the product
→ Support and Training
Post-Production: Keep Code Up and Running
[16]
21
Post-Production: Align Business and Team Goals
→ Team targets: deadlines and revenue goals
→ Team competitions
[17]
22
Key Takeaways
→ Communication, tooling, logging, documentation, debugging
→ Automatically evaluate all components of ML pipeline
→ High model AUC is not always the answer
→ Scope down, then scale up
[18]
23
You Did It!
Code is in prod!
Celebrate!
24
You Did It!
Code is in prod!
Celebrate!
… But not too hard. Tomorrow you start on v2.
Questions?
25
https://goo.gl/DjkCBn
[ 1] http://www.projectcartoon.com/cartoon/1
[ 2] https://research.google.com/pubs/pub43146.html
[ 3] https://www.linkedin.com/pulse/when-your-tech-debt-comes-due-kevin-scott
[ 4] https://www.sec.gov/news/press-release/2013-222
[ 5] http://dilbert.com/strip/2017-01-03
[ 6] https://www.joelonsoftware.com/2000/08/09/the-joel-test-12-steps-to-better-code/
[ 7] https://solidgeargroup.com/wp-content/uploads/2016/07/tower_cheatsheet_white_EN_0.pdf
[ 8] http://geek-and-poke.com/geekandpoke/2014/2/23/dev-cycle-friday-evening-edition
[ 9] https://www.eecs.tufts.edu/~dsculley/papers/ml_test_score.pdf
[10] http://martin.zinkevich.org/rules_of_ml/rules_of_ml.pdf
[11] https://www.slideshare.net/Tech_InMobi/building-machine-learning-pipelines
[12] https://www.researchgate.net/publication/262569275_Testing_Scientific_Software_A_Systematic_Literature_Review
[13] https://classeval.wordpress.com/introduction/basic-evaluation-measures/
[14] https://xkcd.com/1024/ [15] https://xkcd.com/1319/
[16] https://www.devrant.io/search?term=debugging
[17] https://marketoonist.com/2015/03/hackathons.html
[18] https://s-media-cache-ak0.pinimg.com/originals/9c/25/08/9c25082f5c4d3477124356e45673d426.png
[19] https://www.pinterest.com/pin/177258935306351629/
[20] http://kellysutton.com/2017/09/01/comment-drift.html
[21] http://www.safetyresearch.net/blog/articles/toyota-unintended-acceleration-and-big-bowl-%E2%80%9Cspaghetti%E2%80%9D-code 26
References
27
Appendix: Establish Business Use Case
→ Kick-off meeting with stakeholders:
• Discuss use case, motivation and scope
• Brainstorm and discuss potential solutions
• Format of deliverable? Prod env (if appropriate)
• Iron-out deadlines, checkpoints and ongoing support structure
• Scope down, then scale up
• Close meeting with recap of action items
Key Takeaways: communication + clear expectations
[19]

Más contenido relacionado

Similar a Productionalizing Machine Learning Models: The Good, The Bad and The Ugly

Six cigma AJAL
Six cigma AJALSix cigma AJAL
Six cigma AJALAJAL A J
 
The Need for Speed
The Need for SpeedThe Need for Speed
The Need for SpeedCapgemini
 
Managing an Experimentation Platform by LinkedIn Product Leader
Managing an Experimentation Platform by LinkedIn Product LeaderManaging an Experimentation Platform by LinkedIn Product Leader
Managing an Experimentation Platform by LinkedIn Product LeaderProduct School
 
Project Management (April - 2014) [CBSGS - Paper Solution] {Mumbai University}
Project Management (April - 2014) [CBSGS - Paper Solution] {Mumbai University}Project Management (April - 2014) [CBSGS - Paper Solution] {Mumbai University}
Project Management (April - 2014) [CBSGS - Paper Solution] {Mumbai University}Mumbai B.Sc.IT Study
 
Six sigma ajal
Six sigma ajalSix sigma ajal
Six sigma ajalAJAL A J
 
Nilesh Patil PLM Teamcenter manufacturing
Nilesh Patil PLM Teamcenter manufacturingNilesh Patil PLM Teamcenter manufacturing
Nilesh Patil PLM Teamcenter manufacturingNilesh Patil
 
[Rakuten TechConf2014] [C-6] Japan ICHIBA Daily Work - Tools & Processes
[Rakuten TechConf2014] [C-6] Japan ICHIBA Daily Work - Tools & Processes[Rakuten TechConf2014] [C-6] Japan ICHIBA Daily Work - Tools & Processes
[Rakuten TechConf2014] [C-6] Japan ICHIBA Daily Work - Tools & ProcessesRakuten Group, Inc.
 
Ibm connect 2014_presentation - cust109
Ibm connect 2014_presentation - cust109Ibm connect 2014_presentation - cust109
Ibm connect 2014_presentation - cust109Beck et al. GmbH
 
The A-Z of Data: Introduction to MLOps
The A-Z of Data: Introduction to MLOpsThe A-Z of Data: Introduction to MLOps
The A-Z of Data: Introduction to MLOpsDataPhoenix
 
CH-2.1 Conceptualizing and Initializing the IT Project.ppt
CH-2.1 Conceptualizing and Initializing the IT Project.pptCH-2.1 Conceptualizing and Initializing the IT Project.ppt
CH-2.1 Conceptualizing and Initializing the IT Project.pptamanuel236786
 
Measuring Productivity from Model-Based Development
Measuring Productivity from Model-Based DevelopmentMeasuring Productivity from Model-Based Development
Measuring Productivity from Model-Based DevelopmentJuha-Pekka Tolvanen
 
PMI CH AMM2023 - Bye Bye Project Manager - SwissQ.pptx
PMI CH AMM2023 - Bye Bye Project Manager - SwissQ.pptxPMI CH AMM2023 - Bye Bye Project Manager - SwissQ.pptx
PMI CH AMM2023 - Bye Bye Project Manager - SwissQ.pptxChristoph Wolf
 
"Quality Assurance: Achieving Excellence in startup without a Dedicated QA", ...
"Quality Assurance: Achieving Excellence in startup without a Dedicated QA", ..."Quality Assurance: Achieving Excellence in startup without a Dedicated QA", ...
"Quality Assurance: Achieving Excellence in startup without a Dedicated QA", ...Fwdays
 
Project Management (October - 2014) [CBSGS - Paper Solution] {Mumbai University}
Project Management (October - 2014) [CBSGS - Paper Solution] {Mumbai University}Project Management (October - 2014) [CBSGS - Paper Solution] {Mumbai University}
Project Management (October - 2014) [CBSGS - Paper Solution] {Mumbai University}Mumbai B.Sc.IT Study
 
Using formal methods in Industrial Software Development
Using formal methods in Industrial Software DevelopmentUsing formal methods in Industrial Software Development
Using formal methods in Industrial Software DevelopmentRobert van Lieshout
 
Devoteam itsmf 2021 - from business automation to continuous value-driven i...
Devoteam   itsmf 2021 - from business automation to continuous value-driven i...Devoteam   itsmf 2021 - from business automation to continuous value-driven i...
Devoteam itsmf 2021 - from business automation to continuous value-driven i...itSMF Belgium
 
From Data Science to MLOps
From Data Science to MLOpsFrom Data Science to MLOps
From Data Science to MLOpsCarl W. Handlin
 
How to Prepare for Product Based Companies?
How to Prepare for Product Based Companies?How to Prepare for Product Based Companies?
How to Prepare for Product Based Companies?Joel Kingsley
 

Similar a Productionalizing Machine Learning Models: The Good, The Bad and The Ugly (20)

Six cigma AJAL
Six cigma AJALSix cigma AJAL
Six cigma AJAL
 
Introduction to Six Sigma
Introduction to Six SigmaIntroduction to Six Sigma
Introduction to Six Sigma
 
The Need for Speed
The Need for SpeedThe Need for Speed
The Need for Speed
 
Managing an Experimentation Platform by LinkedIn Product Leader
Managing an Experimentation Platform by LinkedIn Product LeaderManaging an Experimentation Platform by LinkedIn Product Leader
Managing an Experimentation Platform by LinkedIn Product Leader
 
Project Management (April - 2014) [CBSGS - Paper Solution] {Mumbai University}
Project Management (April - 2014) [CBSGS - Paper Solution] {Mumbai University}Project Management (April - 2014) [CBSGS - Paper Solution] {Mumbai University}
Project Management (April - 2014) [CBSGS - Paper Solution] {Mumbai University}
 
Six sigma ajal
Six sigma ajalSix sigma ajal
Six sigma ajal
 
Nilesh Patil PLM Teamcenter manufacturing
Nilesh Patil PLM Teamcenter manufacturingNilesh Patil PLM Teamcenter manufacturing
Nilesh Patil PLM Teamcenter manufacturing
 
[Rakuten TechConf2014] [C-6] Japan ICHIBA Daily Work - Tools & Processes
[Rakuten TechConf2014] [C-6] Japan ICHIBA Daily Work - Tools & Processes[Rakuten TechConf2014] [C-6] Japan ICHIBA Daily Work - Tools & Processes
[Rakuten TechConf2014] [C-6] Japan ICHIBA Daily Work - Tools & Processes
 
Ibm connect 2014_presentation - cust109
Ibm connect 2014_presentation - cust109Ibm connect 2014_presentation - cust109
Ibm connect 2014_presentation - cust109
 
The A-Z of Data: Introduction to MLOps
The A-Z of Data: Introduction to MLOpsThe A-Z of Data: Introduction to MLOps
The A-Z of Data: Introduction to MLOps
 
CH-2.1 Conceptualizing and Initializing the IT Project.ppt
CH-2.1 Conceptualizing and Initializing the IT Project.pptCH-2.1 Conceptualizing and Initializing the IT Project.ppt
CH-2.1 Conceptualizing and Initializing the IT Project.ppt
 
Measuring Productivity from Model-Based Development
Measuring Productivity from Model-Based DevelopmentMeasuring Productivity from Model-Based Development
Measuring Productivity from Model-Based Development
 
PMI CH AMM2023 - Bye Bye Project Manager - SwissQ.pptx
PMI CH AMM2023 - Bye Bye Project Manager - SwissQ.pptxPMI CH AMM2023 - Bye Bye Project Manager - SwissQ.pptx
PMI CH AMM2023 - Bye Bye Project Manager - SwissQ.pptx
 
"Quality Assurance: Achieving Excellence in startup without a Dedicated QA", ...
"Quality Assurance: Achieving Excellence in startup without a Dedicated QA", ..."Quality Assurance: Achieving Excellence in startup without a Dedicated QA", ...
"Quality Assurance: Achieving Excellence in startup without a Dedicated QA", ...
 
6sigma
6sigma6sigma
6sigma
 
Project Management (October - 2014) [CBSGS - Paper Solution] {Mumbai University}
Project Management (October - 2014) [CBSGS - Paper Solution] {Mumbai University}Project Management (October - 2014) [CBSGS - Paper Solution] {Mumbai University}
Project Management (October - 2014) [CBSGS - Paper Solution] {Mumbai University}
 
Using formal methods in Industrial Software Development
Using formal methods in Industrial Software DevelopmentUsing formal methods in Industrial Software Development
Using formal methods in Industrial Software Development
 
Devoteam itsmf 2021 - from business automation to continuous value-driven i...
Devoteam   itsmf 2021 - from business automation to continuous value-driven i...Devoteam   itsmf 2021 - from business automation to continuous value-driven i...
Devoteam itsmf 2021 - from business automation to continuous value-driven i...
 
From Data Science to MLOps
From Data Science to MLOpsFrom Data Science to MLOps
From Data Science to MLOps
 
How to Prepare for Product Based Companies?
How to Prepare for Product Based Companies?How to Prepare for Product Based Companies?
How to Prepare for Product Based Companies?
 

Último

Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...SUHANI PANDEY
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfMarinCaroMartnezBerg
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Valters Lauzums
 
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxBPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxMohammedJunaid861692
 
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceBDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceDelhi Call girls
 
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Delhi Call girls
 
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779Delhi Call girls
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Researchmichael115558
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz1
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxolyaivanovalion
 
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...amitlee9823
 
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...amitlee9823
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxolyaivanovalion
 
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...shivangimorya083
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfLars Albertsson
 
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...amitlee9823
 

Último (20)

Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdf
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
 
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxBPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
 
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceBDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
 
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
 
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
 
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Research
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signals
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptx
 
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
 
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
 
Sampling (random) method and Non random.ppt
Sampling (random) method and Non random.pptSampling (random) method and Non random.ppt
Sampling (random) method and Non random.ppt
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptx
 
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdf
 
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
 

Productionalizing Machine Learning Models: The Good, The Bad and The Ugly

  • 1. Productionalizing Machine Learning Models: Good, Bad and Ugly Irina Kukuyeva, Ph.D. SoCal PyData April 26, 2018
  • 2. 2 Fashion Consulting IoT Healthcare Media & Entertainment Finance CPG Retail Video Game Publisher Online Advertising Healthcare Ph.D. My Background
  • 3. 3 Spectrum of (Select) Production Environments Love, love, love leather/faux leather jackets! Especially the blue! Positive sentiment Fashion Customer Retention Near-real time Consulting Revenue $3M+/year ASAP Online Advertising* Revenue $1M+/year Near-real time Finance Automation Daily
  • 4. What ML Model Lifecycle Really Looks Like what customer described what data looked like what DS began to build what budget could buy what pivot looked like what code got reused what got tested [1] what got pushed to prod what got documented what customer wanted 4
  • 5. Agenda what customer described what data looked like what DS began to build what budget could buy what pivot looked like what code got reused what got tested what got pushed to prod what got documented Step 1 (Appendix) what customer wanted Step 2: Data QA (Other Talks) Step 3: ML Development (Other Talks) Step 4: Pre-prod Step 5: Prod Step 5: Prod Step 1 (Appendix) 5 Step 4: Pre-prod [1]
  • 7. 7 Pre-Production: Pay Down Tech Debt Technical Debt — Borrowing against future to trade-off between quality of code and speed of delivery now [2], [3] • Incur debt: write code, including ML pipelines [4], [21] • Pay down debt: extensively test and refactor pipeline end-to-end [5]
  • 8. → Test 1: Joel’s Test: 12 Steps to Better Code [6] • Spec? • Source control? Best practices? [7] • One-step build? Daily builds? CI? • Bug database? Release schedule? QA? • Fix bugs before write new code? 8 Pre-Production: Pay Down Tech Debt [8]
  • 9. 9 Consulting Daily stand-up Sprint planning Version control* Fix bugs first Bugs emailed/db Release on bugfix One-step build Atlassian suite Virtual machines Test 1: Joel’s Test: 12 Steps to Better Code … in practice: Pre-Production: Pay Down Tech Debt Fashion Weekly stand-up — Version control Fix bugs first — Release on bugfix One-step build PRD, Trello Virtual env, Docker, CircleCI, cookiecutter Online Advertising* Daily stand-up Sprint planning — — Bug database — — — — Finance — — Version control* Fix bugs first — — One-step build Trello —
  • 10. 10 Pre-Production: Pay Down Tech Debt Test 1: Joel’s Test: 12 Steps to Better Code … in practice:
  • 11. → Test 2: ML Test Score [9], [10] • Data and feature quality • Model development • ML infrastructure • Monitoring ML 11 Pre-Production: Pay Down Tech Debt [11]
  • 12. 12 → Other tips — ML: • Choose simplest model, most appropriate for task and prod env • Test model against (simulated) “ground truth” or 2nd implementation [12] • Evaluate effects of floating point [12] • Model validation beyond AUC [13] Pre-Production: Pay Down Tech Debt
  • 13. → Other tips — Code: • What is the production environment? • Set-up logging • Add else to if or try/except + error • DRY → refactor • Add regression tests • Comment liberally (explain “why”) + up-to-date [20] • Lint Pre-Production: Pay Down Tech Debt [14] 13
  • 14. Consulting Minimal time to add new feature Unsuitable features excluded Test 2: ML Test Score … in practice: – Data and Feature Quality – Pre-Production: Pay Down Tech Debt – Model Development – Baseline model Bias correction Proxy + actual metrics Simulated ground truthBaseline model + 2nd implementation Rolling refresh Performance overall + those most likely to click Proxy + actual metrics Code review (PR) Hyperparameter optimization (sklearn.GridSearchCV) 14 Online Advertising* Fashion Test input features (typing, pytest) Finance Minimal time to add new feature Privacy built-in
  • 15. Consulting Loosely coupled fcns Central repo for clients Regression testing One-step build, prod Pre-Production: Pay Down Tech Debt Missing data check Logging Software + package versions check Data availability check Logging (logging) Evaluates empty + factual responses Local = prod env (virtualenv, Docker) Comp time (timeit) 15 Online Advertising* Streaming Fashion Loosely coupled fcns Streaming API (sanic) Integration test (pytest) One-step build, prod Finance Loosely coupled fcns Streaming One-step build, prod* Reproducibility of training Test 2: ML Test Score … in practice: – ML Infrastructure – – ML Monitoring –
  • 16. 16 Test 2: ML Test Score … in practice (cont’d): Pre-Production: Pay Down Tech Debt
  • 18. 18 Production: Deploy Code and Monitor Performance → One-button push to prod branch/repo → Model Rollout → Monitoring [15]
  • 20. 20 → Documentation + QA → Debugging, debugging, debugging → Bugfix vs. Feature → Container Management → Post-mortem → Use the product → Support and Training Post-Production: Keep Code Up and Running [16]
  • 21. 21 Post-Production: Align Business and Team Goals → Team targets: deadlines and revenue goals → Team competitions [17]
  • 22. 22 Key Takeaways → Communication, tooling, logging, documentation, debugging → Automatically evaluate all components of ML pipeline → High model AUC is not always the answer → Scope down, then scale up [18]
  • 23. 23 You Did It! Code is in prod! Celebrate!
  • 24. 24 You Did It! Code is in prod! Celebrate! … But not too hard. Tomorrow you start on v2.
  • 26. [ 1] http://www.projectcartoon.com/cartoon/1 [ 2] https://research.google.com/pubs/pub43146.html [ 3] https://www.linkedin.com/pulse/when-your-tech-debt-comes-due-kevin-scott [ 4] https://www.sec.gov/news/press-release/2013-222 [ 5] http://dilbert.com/strip/2017-01-03 [ 6] https://www.joelonsoftware.com/2000/08/09/the-joel-test-12-steps-to-better-code/ [ 7] https://solidgeargroup.com/wp-content/uploads/2016/07/tower_cheatsheet_white_EN_0.pdf [ 8] http://geek-and-poke.com/geekandpoke/2014/2/23/dev-cycle-friday-evening-edition [ 9] https://www.eecs.tufts.edu/~dsculley/papers/ml_test_score.pdf [10] http://martin.zinkevich.org/rules_of_ml/rules_of_ml.pdf [11] https://www.slideshare.net/Tech_InMobi/building-machine-learning-pipelines [12] https://www.researchgate.net/publication/262569275_Testing_Scientific_Software_A_Systematic_Literature_Review [13] https://classeval.wordpress.com/introduction/basic-evaluation-measures/ [14] https://xkcd.com/1024/ [15] https://xkcd.com/1319/ [16] https://www.devrant.io/search?term=debugging [17] https://marketoonist.com/2015/03/hackathons.html [18] https://s-media-cache-ak0.pinimg.com/originals/9c/25/08/9c25082f5c4d3477124356e45673d426.png [19] https://www.pinterest.com/pin/177258935306351629/ [20] http://kellysutton.com/2017/09/01/comment-drift.html [21] http://www.safetyresearch.net/blog/articles/toyota-unintended-acceleration-and-big-bowl-%E2%80%9Cspaghetti%E2%80%9D-code 26 References
  • 27. 27 Appendix: Establish Business Use Case → Kick-off meeting with stakeholders: • Discuss use case, motivation and scope • Brainstorm and discuss potential solutions • Format of deliverable? Prod env (if appropriate) • Iron-out deadlines, checkpoints and ongoing support structure • Scope down, then scale up • Close meeting with recap of action items Key Takeaways: communication + clear expectations [19]