Contenu connexe Similaire à MongoDB .local London 2019: Using AWS to Transform Customer Data in MongoDB into AI-driven Personalization (20) Plus de Lisa Roth, PMP (10) MongoDB .local London 2019: Using AWS to Transform Customer Data in MongoDB into AI-driven Personalization1. 1© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
AWS | Using AWS to Transform Customer Data
in MongoDB into AI-driven Personalization
Dylan Tong, Machine Learning Partner Solutions Architect
2. 2© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Trademark
Customer centric use cases…
3. 3© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
Machine Learning
11000011
100011…..
Many possibilities…
Forecasting
Customer Churn Prediction
Personalization
.
.
.
4. 4© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
Source: DeepMind Research, 2015 Source: DeepMind Research, 2016Source: arxiv.org/pdf/1810.00736.pdf, 2018
Super-human level
Deep Convolutional Neural Networks Deep Reinforcement Learning
5. 5© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
Source: https://www.researchgate.net/figure/Andrew-Ngs-30-graph-shows-how-deep-learning-is-said-to-outperforms-traditional_fig6_324476862
6. 6© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
Reinvent the Customer Experience
7. 7© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
Amazon Personalize
• Session based
recommendations
• Predictive Customer
Analytics
Amazon SageMaker RL
• Contextual Bandits:
uplift conversion rates
Conversational AI
• Personalize your apps
with life-like voices
9. 9© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
Customer 1
.
.
.
.
.
Customer N
.
.
.
2. Recommend “similar Item”1. Selection Other Products
Calculate
“rating
vector” for
each product
and
calculate
vector
distance to
measure
similarity
Degree of similarity by co-rating
…
Classic Recommenders: Item-Item Collaborative Filtering
.
.
.
.
.
.
.
…
https://pdfs.semanticscholar.org/0f06/d328f6deb44e5e67408e0c16a8c7356330d1.pdf
10. 10© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
Deep learning techniques have a direct impact on the bottom line
SimilarityPopularity
Neural
network
Matrix
factorization
+15.4%
Engagement
Recurrent Neural
Net + Bandit
+7.4%
Engagement
+20%
Click Through
https://www.slideshare.net/AmazonWebServices/add-realtime-personalization-and-recommendations-to-your-applications-aim395-aws-reinvent-2018
11. 11© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Trademark
Image: François Deloche (https://commons.wikimedia.org/wiki/File:Recurrent_neural_network_unfold.svg), https://creativecommons.org/licenses/by-sa/4.0/legalcode
Customers interaction history: clicks, ratings, purchases…
User Representation
recommend
RNN: History and User Representation
12. 12© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
A month
later…
recommend
Insight: Evolution of interests and disinterests predict future preferences…
Image: François Deloche (https://commons.wikimedia.org/wiki/File:Recurrent_neural_network_unfold.svg), https://creativecommons.org/licenses/by-sa/4.0/legalcode
Interactions, ordering and timing all matter…
User Representation
Session Representations
HRNN: Modeling Sessions
Amazon Research: https://openreview.net/pdf?id=ByzxsrrkJ4
13. 13© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
FRAMEWORKS INTERFACES INFRASTRUCTURE
AI Services
Broadest and deepest set of capabilities
T H E A W S M L S T A C K
VISION SPEECH LANGUAGE CHATBOTS FORECASTING RECOMMENDATIONS
ML Services
ML Frameworks + Infrastructure
P O L L Y T R A N S C R I B E T R A N S L A T E C O M P R E H E N D
& C O M P R E H E N D
M E D I C A L
L E X F O R E C A S TR E K O G N I T I O N
I M A G E
R E K O G N I T I O N
V I D E O
T E X T R A C T P E R S O N A L I Z E
Ground Truth Notebooks Algorithms + Marketplace Reinforcement Learning Training Optimization Deployment HostingAmazon SageMaker
F P G A SE C 2 P 3
& P 3 D N
E C 2 G 4
E C 2 C 5
I N F E R E N T I AG R E E N G R A S S E L A S T I C
I N F E R E N C E
D L
C O N T A I N E R S
& A M I s
E L A S T I C
K U B E R N E T E S
S E R V I C E
E L A S T I C
C O N T A I N E R
S E R V I C E
14. 14© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
MongoDB
GetRankedList:
{ "campaignArn": "string",
"inputList": [ "string" ],
"userId": "string" }
GetRecommendations:
{ "campaignArn": "string",
"itemId": "string",
"numResults": number,
"userId": "string" }
Amazon Personalize: AutoML
Real-time Recommendations API
Reviews collection
{ "itemId": …,
"userId": …,
"rating": …,
"ts": …
…
}
15. 15© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
MongoDB
personalize_events.put_events(
trackingId = 'tracking_id’,
userId= 'USER_ID’,
sessionId = 'session_id’,
eventList = [{ 'sentAt': TIMESTAMP,
'eventType': 'EVENT_TYPE’,
'properties': "{"itemId": "ITEM_ID"}" }])
AWS SDK:
Event Recorder
Cold starts and Online Learning
Application
17. 17© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
MongoDB
Amazon S3
Import Data
18. 18© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
AutoML
19. 19© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
Deploy Endpoint
20. 20© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
Multivariate Optimization
Source: https://www.kdd.org/kdd2017/papers/view/an-efficient-bandit-algorithm-for-realtime-multivariate-optimization
21. 21© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
After only a single week of online optimization, we saw a 21%
conversion increase compared to the median layout...
Amazon.com: https://arxiv.org/pdf/1810.09558.pdf
Contextual Bandits
22. 22© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
State T
Actions
Agent
Environment
Policy
Learner
Rewards
State T+1
Reinforcement Learning (RL)
23. 23© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
2. Actions
(Select a layout)
Policy
Model
Contextual Bandits (CB)
1. Context (State)
F(context) à action
• Demographics
• Device
• Promo Reference
• Geography
Agent
Environment
15%
25%
77%
24. 2. Actions
(Select a layout)Policy
Model
Contextual Bandits: Multivariate Testing
1. Context (State)
F(context) à action
• Demographics
• Device
• Promo Reference
• Geography
Arms = Layout Variations
.
.
.
Agent
25. 2. Actions
(Select a layout)
4. Rewards
Policy
Model
Contextual Bandits and RL
1. Context (State)
F(context) à action
.
.
.
Agent
Application (Environment)
3. Prescribe Layout
Arms = Layout Variations
26. 26© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
FRAMEWORKS INTERFACES INFRASTRUCTURE
AI Services
Broadest and deepest set of capabilities
T H E A W S M L S T A C K
VISION SPEECH LANGUAGE CHATBOTS FORECASTING RECOMMENDATIONS
ML Services
ML Frameworks + Infrastructure
P O L L Y T R A N S C R I B E T R A N S L A T E C O M P R E H E N D
& C O M P R E H E N D
M E D I C A L
L E X F O R E C A S TR E K O G N I T I O N
I M A G E
R E K O G N I T I O N
V I D E O
T E X T R A C T P E R S O N A L I Z E
Ground Truth Notebooks Algorithms + Marketplace Reinforcement Learning Training Optimization Deployment HostingAmazon SageMaker
F P G A SE C 2 P 3
& P 3 D N
E C 2 G 4
E C 2 C 5
I N F E R E N T I AG R E E N G R A S S E L A S T I C
I N F E R E N C E
D L
C O N T A I N E R S
& A M I s
E L A S T I C
K U B E R N E T E S
S E R V I C E
E L A S T I C
C O N T A I N E R
S E R V I C E
27. 27© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
MongoDB Atlas
Training Initial Model: Warm Starts (…if data exists)
Amazon S3
MongoDB DataLake
Experience Data:
Source: web and application logs:
• Context features (state): eg. device, geo, promo
referrer…etc.
• Action: One of N layout variations
• Action Probability: chance that action is prescribed
given the context for unbiasing the data.
• Reward/Cost: Selected value for a positive outcome.
For instance, +1 for a click.
1. Experience data is prep and made available in the data lake.
28. 28© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
MongoDB Atlas
Amazon SageMaker Training: “BYOS” Approach
Amazon S3
MongoDB DataLake
Amazon SageMaker
Train
2. “Bring your own script”:
OR
Algorithm Environment
29. 29© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
Bring Your Own Script for Vowpal Wabbit
Amazon S3
MongoDB DataLake
Amazon SageMaker
Train
2. “Bring your own script”:
Usage: ./vw -d train.dat --cb_explore 10 --epsilon 0.1
Vowpal Wabbit Contextual Bandits
Amazon SageMaker Examples:
VW Python Scripts (CLI wrapper)
1. https://github.com/VowpalWabbit/vowpal_wabbit/wiki/Contextual-Bandit-algorithms
2. https://github.com/awslabs/amazon-sagemaker-examples/tree/master/reinforcement_learning/bandits_statlog_vw_customEnv/src
30. 30© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
estimator = RLEstimator(entry_point="train-vw.py",
source_dir='src',
dependencies=["common/sagemaker_rl"],
image_name=custom_image_name,
role=role,
train_instance_type=instance_type,
train_instance_count=1,
output_path=s3_output_path,
base_job_name=job_name_prefix,
hyperparameters = {…}
)
3. Launch Training Jobs: SageMaker provisions a cluster and runs the training job—only pay for what
you use.
Amazon SageMaker Training
estimator.fit(…)
31. 31© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
4. Deploy the model for real-time inference
Amazon SageMaker Hosting
Amazon S3SageMaker
Training
Export VW
model artifacts
I. Register model:
sagemaker_model = sagemaker.model.Model(
image=self.image,
role=self.resource_manager.iam_role_arn,
name=model_id,
model_data=model_record["s3_model_output_path"],
sagemaker_session=self.sagemaker_session,
env=environ_vars)
Deploy
endpoint
SageMaker
Hosting
II. Deploy endpoint:
sagemaker_model.deploy(
initial_instance_count=hosting_instance_count,
instance_type=hosting_instance_type,
endpoint_name=self.experiment_id)
32. 32© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
Application
MongoDB Atlas
1. Users’ Context:
{ Device: …
Geo: …
Promo: …}
2. Action:
Use Layout variant N
MVT Service
Multivariate Testing in Production
Real-time Endpoint
(Managed by
Amazon SageMaker)
Policy Model
33. 33© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
+1
+1 +1
+1
+1 +1
+1
+100+100
+1
Exploration and Exploitation
34. 34© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
Application
MongoDB Atlas
1. Users’ Context:
{ Device: …
Geo: …
Promo: …}
2. Action:
Use Layout variant N
MVT Service
Exploration Policy
Exploration Policy:
Epsilon-Greedy: Use action
prescribed by trained policy model
with probability (1-e), and one that is
sampled uniformly at random with
probability e.
Other policies: UCB, Bagging, Online
cover…
35. 35© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
Application
MongoDB Atlas
MVT Service3. Capture Experiences:
I. Reward Tracking: Event Id,
Reward/Cost
II. Inference Logging: Event Id,
Context, Action, Action
Probability
III. Associate rewards with
inference events to augment the
training set (experience data).
Inference and Experience Capture
Rewards tracking Inference logging
Amazon S3
MongoDB Datalake
CB
Algorithm
36. 36© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
Re-train, Evaluate and Re-deploy
Amazon S3
MongoDB Datalake
Model Variant 1
Re-train
Model Variant N
Offline Evaluation (Replay): Compare new and old models with varying policies
Re-deploy
best model
Collect
experience data
Minimize cumulative ”regret”
(opportunity cost)
37. 37© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
87.4% 88.7% 91.3%
92.5% 93.0% …
Converges Towards an Optimal Policy
Sample SageMaker Notebook
https://github.com/awslabs/amazon-sagemaker-examples/blob/master/reinforcement_learning/bandits_statlog_vw_customEnv/bandits_statlog_vw_customEnv.ipynb
38. 38© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
Personalizing Conversational AI
39. 39© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
FRAMEWORKS INTERFACES INFRASTRUCTURE
AI Services
Broadest and deepest set of capabilities
T H E A W S M L S T A C K
VISION SPEECH LANGUAGE CHATBOTS FORECASTING RECOMMENDATIONS
ML Services
ML Frameworks + Infrastructure
P O L L Y T R A N S C R I B E T R A N S L A T E C O M P R E H E N D
& C O M P R E H E N D
M E D I C A L
L E X F O R E C A S TR E K O G N I T I O N
I M A G E
R E K O G N I T I O N
V I D E O
T E X T R A C T P E R S O N A L I Z E
Ground Truth Notebooks Algorithms + Marketplace Reinforcement Learning Training Optimization Deployment HostingAmazon SageMaker
F P G A SE C 2 P 3
& P 3 D N
E C 2 G 4
E C 2 C 5
I N F E R E N T I AG R E E N G R A S S E L A S T I C
I N F E R E N C E
D L
C O N T A I N E R S
& A M I s
E L A S T I C
K U B E R N E T E S
S E R V I C E
E L A S T I C
C O N T A I N E R
S E R V I C E
40. 40© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
Amazon Polly: Natural Voices using Neural TTS
US English Joanna voice
“President Donald Trump said on
March 13 his administration was
ordering the grounding of all Max 8
and 9 models, hours after Canada
said it was grounding the planes after
analyzing new satellite tracking
data.”
Standard Newscaster
NTTS
41. 41© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
Amazon Polly: Personalize Your Voices
Justin
English (US)
Male, Child
Brian
English (UK)
Male, Adult
42. 42© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
Voice Modification
<speak>
This is Brian without any voice modifications.
<amazon:effect vocal-tract-length="+15%"> Imagine now that I got bigger… </amazon:effect>
<amazon:effect vocal-tract-length="+25%"> Suppose that I got even bigger still… </amazon:effect>
Now let's go back and hear the effect when I go in the opposite direction.
<amazon:effect vocal-tract-length="-15%"> Can you tell that I'm getting smaller? </amazon:effect>
<amazon:effect vocal-tract-length="-25%"> Now I'm even smaller than before. </amazon:effect>
</speak>
43. 43© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
Amazon
API Gateway
AWS Lambda Amazon Elastic
Kubernetes Service
…
Your choice of compute…
Deploy as a microservice
Public
API endpoints
Backend service logic
Application
44. 44© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
Amazon
API Gateway
Amazon Polly
80 TPS
100 TPS (burst)
Params =
{ "Engine": "string",
"LanguageCode": "string",
"LexiconNames": [ "string" ],
"OutputFormat": "string",
"SampleRate": "string",
"SpeechMarkTypes": [ "string" ],
"Text": "string",
"TextType": "string",
"VoiceId": "string" }
Polly.synthesizeSpeech
(params, (err, data) => {…}
Know your performance requirements
45. 45© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
Amazon
API Gateway
Amazon Polly
MongoDB Atlas
Amazon S3
2a. Metadata
2b. Pre-synthesize
recordings
1. Synthesize Text
Build in Caching and Pre-processing
Queue
46. 46© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
Amazon
API Gateway
1. Context
MongoDB Atlas
Amazon S3
2. Get metadata
Amazon CloudFront
3. Retrieve voice samples
CDN Origin
Cache and stream from the edge
47. 47© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
Github: Lex Chatbot Example
Branding Chatbots through Voice
Amazon Lex
https://github.com/aws-samples/aws-lex-web-ui
48. 48© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved |
#MDBlocal
Using AWS to Transform
Customer Data in
MongoDB into AI-driven
Personalization
Dylan Tong (dylatong@amazon.com)
https://www.surveymonkey.com/r/8L63FGV