Real-Time Decisions Using ML on the Google Cloud Platform - - PowerPoint PPT Presentation

real time decisions using ml on the google cloud platform
SMART_READER_LITE
LIVE PREVIEW

Real-Time Decisions Using ML on the Google Cloud Platform - - PowerPoint PPT Presentation

Real-Time Decisions Using ML on the Google Cloud Platform Przemysaw Pastuszka & Carlos Garcia QCon London 7th March 2018 How many of you are interested in machine learning? but how many of you are running real-time machine


slide-1
SLIDE 1

Real-Time Decisions Using ML on the Google Cloud Platform

Przemysław Pastuszka & Carlos Garcia QCon London 7th March 2018

slide-2
SLIDE 2

How many of you are interested in machine learning?

slide-3
SLIDE 3

but… how many of you are running real-time machine learning in production?

slide-4
SLIDE 4

Who is Ocado?

Ocado is the world’s largest dedicated

  • nline grocery retailer

We have 645,000 active shoppers And 49,000 SKUs in

  • ur webshop

Three highly-automated fulfilment centres 263,000 orders a week ‘picked’ 3 million routing calculations per second

slide-5
SLIDE 5
slide-6
SLIDE 6

What Ocado Technology does

(1) Cloud and AI (2) Automation and robotics (3) Big Data (4) Web and app development (5) IoT

slide-7
SLIDE 7

Fraud: An ML journey

slide-8
SLIDE 8
slide-9
SLIDE 9
slide-10
SLIDE 10

But then… what is fraud?

  • Mainly chargebacks
  • Other types of fraud?
  • Learn from the actual outcome
slide-11
SLIDE 11

Do I really need to do any ML?

slide-12
SLIDE 12

Know your target

  • Do you need ML?
  • What do you want to predict?
  • How good are you at predicting that?
slide-13
SLIDE 13

Cost of mistakes

  • False positives and false negatives
  • How expensive are they?
slide-14
SLIDE 14

Start with heuristics

  • Ask domain experts
  • Derive rules from expert knowledge
  • “If more than 80% of order is alcohol, then classify as risky”
slide-15
SLIDE 15

Heuristics are not enough

slide-16
SLIDE 16

Motivations for Machine Learning

Data-driven

slide-17
SLIDE 17

Motivations for Machine Learning

Data-driven Fraudsters learn

slide-18
SLIDE 18

Motivations for Machine Learning

Data-driven Fraudsters learn Customer patterns

slide-19
SLIDE 19

Motivations for Machine Learning

Data-driven Fraudsters learn Business changes Customer patterns

slide-20
SLIDE 20

Challenges

  • Fraud (human) agents
  • ML is affected by human decisions
  • Unbalanced classes (fraud / not-fraud)
slide-21
SLIDE 21

What ML model do you choose?

slide-22
SLIDE 22

“With great power there must also come… great responsibility”

Spider-Man

slide-23
SLIDE 23

Criteria

Online vs batch predictions

slide-24
SLIDE 24

Criteria

Online vs batch predictions Explainable predictions

slide-25
SLIDE 25

Challenge your explanations

“Why should I trust you?”

2016, M. Tulio, S. Singh, C. Guestrin

slide-26
SLIDE 26

Criteria

Online vs batch predictions Explainable predictions Programming language

slide-27
SLIDE 27

Criteria

Online vs batch predictions Explainable predictions Cloud vs on-premise Programming language

slide-28
SLIDE 28

Our ML choice

slide-29
SLIDE 29

Criteria

Online vs batch predictions Explainable predictions Cloud vs on-premise Programming language

  • nline

preferable cloud Python / Java

slide-30
SLIDE 30

Machine Learning Engine µService Cloud Storage Model

slide-31
SLIDE 31
slide-32
SLIDE 32

Interesting alternatives

Amazon SageMaker

slide-33
SLIDE 33

Interesting alternatives

Amazon SageMaker Google Cloud Machine Learning Engine

slide-34
SLIDE 34

Problem #1 Not fast enough

slide-35
SLIDE 35

Data exploration cycle

State the hypothesis Act Validate

03 01 02

slide-36
SLIDE 36

Big Query

Validate your hypothesis - fast!

slide-37
SLIDE 37
slide-38
SLIDE 38
slide-39
SLIDE 39

Problem #2 Data delivered too late

slide-40
SLIDE 40

µService µService µService µService

Amazon Web Services Google Cloud Platform

Big Query Kinesis Data Flow Apache Beam +

slide-41
SLIDE 41

List<String> strings = ... strings.stream().collect( Collectors.groupingBy( word -> word.charAt(0), Collectors.counting())); PCollection<String> pipeline = ... pipeline .apply(MapElements.via(row -> KV.of(word.charAt(0), word))) .apply(GroupByKey.create()) .apply(Count.perKey())

slide-42
SLIDE 42

Apache Beam Apache Apex Apache Flink Apache Spark Google Dataflow Apache Gearpump

slide-43
SLIDE 43

Problem #3 Missing data

slide-44
SLIDE 44

Missing data

slide-45
SLIDE 45

Capture every change to the business state

slide-46
SLIDE 46

Training

slide-47
SLIDE 47
slide-48
SLIDE 48

train(C1, … CN, O1, … ON, Y) = model C1, … CN, O1, … ON - customer and order features C1- Average basket size for the customer O1- % of alcoholic items in current order ... Y - Fraud or not fraud

slide-49
SLIDE 49

Machine Learning Engine Model Features Events

C1…, O1, …

slide-50
SLIDE 50

Machine Learning Engine Model Features Events SQL Apache Airflow

C1…, O1, …

slide-51
SLIDE 51

Serving predictions

slide-52
SLIDE 52

train(C1, … CN, O1, … ON, Y) = model model(C1, … CN, O1, … ON) = prediction C1, … CN, O1, … ON - customer and order features C1- Average basket size for the customer O1- % of alcoholic items in current order ... Y - Fraud or not fraud prediction - Probability of current order being fraudulent

slide-53
SLIDE 53

Model µService

O1, … ON

Machine Learning Engine

slide-54
SLIDE 54

Model Features Events SQL Apache Airflow µService Datastore Custom App

ID: C1… ID, O1, … C1…, O1, …

Machine Learning Engine

slide-55
SLIDE 55

Model Features Events SQL Apache Airflow µService Datastore Custom App

ID: C1… ID, O1, … C1…, O1, …

Machine Learning Engine Training Serving

C1…, O1, …

slide-56
SLIDE 56

Architecting for the future

slide-57
SLIDE 57

Machine Learning Engine Model Features Events SQL Apache Airflow Training µService Datastore Serving Custom App

slide-58
SLIDE 58

Know your target Keep It Simple Choose your model wisely Google Cloud ML Engine for Neural Nets Have data and tools ready BigQuery is king Unified architecture for training and serving predictions

slide-59
SLIDE 59

Thank you!