SlideShare a Scribd company logo
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Build Machine Learning Applications with
AWS Lambda & Amazon SageMaker
Diego Natali
Solutions Architect
Amazon Web Services EMEA
S R V 4 2 0
Giuseppe Angelo Porcelli
Sr. Solutions Architect
Amazon Web Services EMEA
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Repeats
Friday, 30
SRV420-R1
Build Machine Learning Applications with AWS Lambda & Amazon SageMaker
10:45 – AM | Venetian, Level 4, Lando 4304
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
THE MACHINE LEARNING PROCESS
Business Problem -
ML problem
framing
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
THE MACHINE LEARNING PROCESS
Business Problem -
ML problem
framing
Data Collection
Data Integration
Data Preparation &
Cleaning
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
THE MACHINE LEARNING PROCESS
Data Visualization
& Analysis
Business Problem -
ML problem
framing
Data Collection
Data Integration
Data Preparation &
Cleaning
Feature
Engineering
Model Training &
Parameter Tuning
Model Evaluation
Experiment, Train, Tune and Evaluate
• Setup and manage Notebook
Environments
• Setup and manage Training Clusters
• Write Data Connectors
• Scale ML algorithms to large datasets
• Distribute ML training algorithm to
multiple machines
• Secure Model artifacts
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
THE MACHINE LEARNING PROCESS
Data Visualization
& Analysis
Business Problem -
ML problem
framing
Data Collection
Data Integration
Data Preparation &
Cleaning
Feature
Engineering
Are
Business
goals met?
Monitoring &
Debugging
- Predictions
Yes
Re-training
Model Training &
Parameter Tuning
Model Evaluation Model Deployment
Deploy, Monitor and Debug
• Setup and manage Model Inference
Clusters
• Manage and Auto-Scale Model
Inference APIs
• Monitor and Debug Model Predictions
• Models versioning and performance
tracking
• Automate New Model version
promotion to production (A/B testing)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
THE MACHINE LEARNING PROCESS
Data Visualization
& Analysis
Business Problem -
ML problem
framing
Data Collection
Data Integration
Data Preparation &
Cleaning
Feature
Engineering
Are
Business
goals met?
Monitoring &
Debugging
- Predictions
YesNo
DataAugmentation
Feature
Augmentation
Re-training
Model Training &
Parameter Tuning
Model Evaluation Model Deployment
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
WHERE SHOULD WE SPEND TIME?
BUI L D T R AI N D E P L O Y
T U NE
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AMAZON SAGEMAKER
End-to-end encryption with KMS
End-to-end VPC support
Compliance and audit capabilities
Metadata and experiment management capabilities
Pay as you go
Fully managed
hosting with auto-
scaling
One-click
deployment
Pre-built
notebooks for
common problems
Built-in, high
performance
algorithms
One-click
training
BUI L D T R AI N & T UNE D E P L O Y
Hyperparameter
optimization
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
EXECUTING INFERENCES
Amazon SageMaker Deployment AWS Lambda
Real-time Sync Use managed real-time inference cluster On-demand request-based model
Real-time Async
Use Amazon Kinesis and AWS Lambda to
invoke the real-time inference endpoint
Use Amazon Kinesis and AWS Lambda to
host the model and execute inferences in
Lambda
Batch Use batch transform Need to implement batch processing
Edge (AWS Greengrass)
Use built-in AWS Greengrass model
hosting
Deploy a Lambda function on AWS
Greengrass to execute inferences
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
USING AWS LAMBDA
PROS
Develop Modern Applications serverless
Charged per request and execution duration
Effortless, limitless scalability, high availability, fault tolerance,
etc.
Lower the cost of inferences
No infrastructure to maintain
1 million free executions
Event-based model
Example: 100M requests for about $54/month
CONS
GPU not yet available
512 MB /tmp limit
250 MB limit for uncompressed size of code/dependencies
Need to create your deployment package and pipeline to
automate the process
Cold start (~5s TF, ~2s MXNet)
Infrastructure to mantain if not using Amazon SageMaker for
training
Need to include and manage all dependencies
Need to create your own API for serving
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AMAZON SAGEMAKER vs AWS LAMBDA
Amazon SageMaker Deployment AWS Lambda
Workload
Well suited for constant and predictable
workloads, with regular and frequent traffic
Well suited for variable or unpredictable
workloads, with intermittent and spiky traffic
Scaling
Configure auto-scaling on the real-time
endpoint
Automatic scaling
Hardware GPU and CPU instances CPU only
Model architecture Any complexity [CNNs, RNNs, etc.] Simple models
A/B Testing Yes Yes
Deployment Fast, one-click deployment
Need to build package and create inference API
from scratch
Monitoring and Debugging Amazon CloudWatch / CloudWatch Logs Amazon CloudWatch / CloudWatch Logs
IT’S A MATTER OF CHOICE
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
THE DATASET
SMS Spam Collection Data Set
• A public set of 5574 SMS labeled messages that have been collected for mobile phone spam
research
• 747 SPAM, 4827 non SPAM
https://archive.ics.uci.edu/ml/datasets/sms+spam+collection
ham Go until jurong point, crazy.. Available only in bugis n great world la e buffet... Cine there
got amore wat...
ham Ok lar... Joking wif u oni...
spam Free entry in 2 a wkly comp to win FA Cup final tkts 21st May 2005. Text FA to 87121 to receive
entry question(std txt rate)T&C's apply 08452810075over18’s
ham U dun say so early hor... U c already then say...
ham Nah I don't think he goes to usf, he lives around here though
spam FreeMsg Hey there darling it's been 3 week's now and no word back! I'd like some fun you up for
it still? Tb ok! XxX std chgs to send, £1.50 to rcv
ham Even my brother is not like to speak with me. They treat me like aids patent.
ham As per your request 'Melle Melle (Oru Minnaminunginte Nurungu Vettam)' has been set as your
callertune for all Callers. Press *9 to copy your friends Callertune
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
WORKFLOW
BUI L D T R AI N & T UNE D E P L O Y
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
TRAINING THE MODEL
LINK TO NOTEBOOK
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
DEPLOYING TO LAMBDA
Get model artifacts from S3
Run an Amazon Linux EC2
Instance or Cloud9
environment
Download pre-built
TF/MXNet Lambda packages
from GitHub in a folder
Write Lambda handler,
package and save Lambda
deployment package to S3
Copy model artifacts in the
folder
https://docs.aws.amazon.com/sagemaker/latest/dg/API_ModelArtifacts.html
https://docs.aws.amazon.com/cloud9/latest/user-guide/welcome.html
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EC2_GetStarted.html
https://github.com/awslabs/mxnet-lambda
https://github.com/ryfeus/lambda-packs
https://docs.aws.amazon.com/lambda/latest/dg/lambda-python-
how-to-create-deployment-package.html
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
LAMBDA COLD START
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AUTOMATING DEPLOYMENT
AWS
CodePipeline
bucket
with
objects
event
(event-
based)
AWS
CloudTrail
Lambda
function
bucket
with
objects
event
(event-
based)
AWS
CloudTrail
Amazon
SageMaker
AWS
CodeBuild
template
stack
change set
bucket
with
objects
Amazon API
Gateway*
Lambda
function
AWS
CodeDeploy
Hook
Lambda
function
Checker
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Thank you!
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Diego Natali
dnnatali@amazon.it
Giuseppe Angelo Porcelli
gianpo@amazon.it
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

More Related Content

What's hot

What's hot (20)

Transforming Computational Fluid Dynamics (CFD) with GPUs on AWS (CMP327) - A...
Transforming Computational Fluid Dynamics (CFD) with GPUs on AWS (CMP327) - A...Transforming Computational Fluid Dynamics (CFD) with GPUs on AWS (CMP327) - A...
Transforming Computational Fluid Dynamics (CFD) with GPUs on AWS (CMP327) - A...
 
How Trek10 Uses Datadog's Distributed Tracing to Improve AWS Lambda Projects ...
How Trek10 Uses Datadog's Distributed Tracing to Improve AWS Lambda Projects ...How Trek10 Uses Datadog's Distributed Tracing to Improve AWS Lambda Projects ...
How Trek10 Uses Datadog's Distributed Tracing to Improve AWS Lambda Projects ...
 
建構全球跨區域 x Active-Active架構的無伺服器化後台服務
建構全球跨區域  x Active-Active架構的無伺服器化後台服務建構全球跨區域  x Active-Active架構的無伺服器化後台服務
建構全球跨區域 x Active-Active架構的無伺服器化後台服務
 
[NEW LAUNCH!] AWS Transit Gateway and Transit VPCs - Reference Architectures ...
[NEW LAUNCH!] AWS Transit Gateway and Transit VPCs - Reference Architectures ...[NEW LAUNCH!] AWS Transit Gateway and Transit VPCs - Reference Architectures ...
[NEW LAUNCH!] AWS Transit Gateway and Transit VPCs - Reference Architectures ...
 
Improve Accessibility Using Machine Learning (AIM332) - AWS re:Invent 2018
Improve Accessibility Using Machine Learning (AIM332) - AWS re:Invent 2018Improve Accessibility Using Machine Learning (AIM332) - AWS re:Invent 2018
Improve Accessibility Using Machine Learning (AIM332) - AWS re:Invent 2018
 
Operationalizing Microsoft Workloads (WIN320) - AWS re:Invent 2018
Operationalizing Microsoft Workloads (WIN320) - AWS re:Invent 2018Operationalizing Microsoft Workloads (WIN320) - AWS re:Invent 2018
Operationalizing Microsoft Workloads (WIN320) - AWS re:Invent 2018
 
From Monolith to Modern Apps: Best Practices (SRV322-R2) - AWS re:Invent 2018
From Monolith to Modern Apps: Best Practices (SRV322-R2) - AWS re:Invent 2018From Monolith to Modern Apps: Best Practices (SRV322-R2) - AWS re:Invent 2018
From Monolith to Modern Apps: Best Practices (SRV322-R2) - AWS re:Invent 2018
 
Scale up a Web Application (ARC409-R) - AWS re:Invent 2018
Scale up a Web Application (ARC409-R) - AWS re:Invent 2018Scale up a Web Application (ARC409-R) - AWS re:Invent 2018
Scale up a Web Application (ARC409-R) - AWS re:Invent 2018
 
Running Amazon EKS Workloads on Amazon EC2 Spot Instances (CMP403-R1) - AWS r...
Running Amazon EKS Workloads on Amazon EC2 Spot Instances (CMP403-R1) - AWS r...Running Amazon EKS Workloads on Amazon EC2 Spot Instances (CMP403-R1) - AWS r...
Running Amazon EKS Workloads on Amazon EC2 Spot Instances (CMP403-R1) - AWS r...
 
Designing for Operability: Getting the Last Nines in Five-Nines Availability ...
Designing for Operability: Getting the Last Nines in Five-Nines Availability ...Designing for Operability: Getting the Last Nines in Five-Nines Availability ...
Designing for Operability: Getting the Last Nines in Five-Nines Availability ...
 
All About the Customer: GraphQL & Real-Time Subscriptions in Customer Service...
All About the Customer: GraphQL & Real-Time Subscriptions in Customer Service...All About the Customer: GraphQL & Real-Time Subscriptions in Customer Service...
All About the Customer: GraphQL & Real-Time Subscriptions in Customer Service...
 
Industrialize Machine Learning Using CI/CD Techniques (FSV304-i) - AWS re:Inv...
Industrialize Machine Learning Using CI/CD Techniques (FSV304-i) - AWS re:Inv...Industrialize Machine Learning Using CI/CD Techniques (FSV304-i) - AWS re:Inv...
Industrialize Machine Learning Using CI/CD Techniques (FSV304-i) - AWS re:Inv...
 
Build a Hybrid Cloud Architecture Using AWS Landing Zones (ENT304-R1) - AWS r...
Build a Hybrid Cloud Architecture Using AWS Landing Zones (ENT304-R1) - AWS r...Build a Hybrid Cloud Architecture Using AWS Landing Zones (ENT304-R1) - AWS r...
Build a Hybrid Cloud Architecture Using AWS Landing Zones (ENT304-R1) - AWS r...
 
The New Normal for Mission-Critical SAP Workloads (ENT219-R1) - AWS re:Invent...
The New Normal for Mission-Critical SAP Workloads (ENT219-R1) - AWS re:Invent...The New Normal for Mission-Critical SAP Workloads (ENT219-R1) - AWS re:Invent...
The New Normal for Mission-Critical SAP Workloads (ENT219-R1) - AWS re:Invent...
 
Lower Costs on Amazon EMR: Auto Scaling, Spot Pricing, & Expert Strategies (A...
Lower Costs on Amazon EMR: Auto Scaling, Spot Pricing, & Expert Strategies (A...Lower Costs on Amazon EMR: Auto Scaling, Spot Pricing, & Expert Strategies (A...
Lower Costs on Amazon EMR: Auto Scaling, Spot Pricing, & Expert Strategies (A...
 
Deep Learning Applications Using TensorFlow, ft. Advanced Microgrid Solutions...
Deep Learning Applications Using TensorFlow, ft. Advanced Microgrid Solutions...Deep Learning Applications Using TensorFlow, ft. Advanced Microgrid Solutions...
Deep Learning Applications Using TensorFlow, ft. Advanced Microgrid Solutions...
 
使用 AWS Step Functions 靈活調度 AWS Lambda (Level:200)
使用 AWS Step Functions 靈活調度 AWS Lambda (Level:200)使用 AWS Step Functions 靈活調度 AWS Lambda (Level:200)
使用 AWS Step Functions 靈活調度 AWS Lambda (Level:200)
 
Architecture Patterns for Multi-Region Active-Active Applications (ARC209-R2)...
Architecture Patterns for Multi-Region Active-Active Applications (ARC209-R2)...Architecture Patterns for Multi-Region Active-Active Applications (ARC209-R2)...
Architecture Patterns for Multi-Region Active-Active Applications (ARC209-R2)...
 
MySQL High Availability & Disaster Recovery (DAT361) - AWS re:Invent 2018
MySQL High Availability & Disaster Recovery (DAT361) - AWS re:Invent 2018MySQL High Availability & Disaster Recovery (DAT361) - AWS re:Invent 2018
MySQL High Availability & Disaster Recovery (DAT361) - AWS re:Invent 2018
 
How Amazon Video Uses DynamoDB Global Tables to Support Tens of Millions of G...
How Amazon Video Uses DynamoDB Global Tables to Support Tens of Millions of G...How Amazon Video Uses DynamoDB Global Tables to Support Tens of Millions of G...
How Amazon Video Uses DynamoDB Global Tables to Support Tens of Millions of G...
 

Similar to Build Machine Learning Applications with AWS Lambda & Amazon SageMaker (SRV420-R1) - AWS re:Invent 2018

Getting Started with AIML Using Amazon Sagemaker_AWSPSSummit_Singapore
Getting Started with AIML Using Amazon Sagemaker_AWSPSSummit_SingaporeGetting Started with AIML Using Amazon Sagemaker_AWSPSSummit_Singapore
Getting Started with AIML Using Amazon Sagemaker_AWSPSSummit_Singapore
Amazon Web Services
 

Similar to Build Machine Learning Applications with AWS Lambda & Amazon SageMaker (SRV420-R1) - AWS re:Invent 2018 (20)

Building Your Own ML Application with AWS Lambda and Amazon SageMaker (SRV404...
Building Your Own ML Application with AWS Lambda and Amazon SageMaker (SRV404...Building Your Own ML Application with AWS Lambda and Amazon SageMaker (SRV404...
Building Your Own ML Application with AWS Lambda and Amazon SageMaker (SRV404...
 
Work with Machine Learning in Amazon SageMaker - BDA203 - Atlanta AWS Summit
Work with Machine Learning in Amazon SageMaker - BDA203 - Atlanta AWS SummitWork with Machine Learning in Amazon SageMaker - BDA203 - Atlanta AWS Summit
Work with Machine Learning in Amazon SageMaker - BDA203 - Atlanta AWS Summit
 
Perform Machine Learning at the IoT Edge using AWS Greengrass and Amazon Sage...
Perform Machine Learning at the IoT Edge using AWS Greengrass and Amazon Sage...Perform Machine Learning at the IoT Edge using AWS Greengrass and Amazon Sage...
Perform Machine Learning at the IoT Edge using AWS Greengrass and Amazon Sage...
 
Work with Machine Learning in Amazon SageMaker - BDA203 - Toronto AWS Summit
Work with Machine Learning in Amazon SageMaker - BDA203 - Toronto AWS SummitWork with Machine Learning in Amazon SageMaker - BDA203 - Toronto AWS Summit
Work with Machine Learning in Amazon SageMaker - BDA203 - Toronto AWS Summit
 
Getting Started with AIML Using Amazon Sagemaker_AWSPSSummit_Singapore
Getting Started with AIML Using Amazon Sagemaker_AWSPSSummit_SingaporeGetting Started with AIML Using Amazon Sagemaker_AWSPSSummit_Singapore
Getting Started with AIML Using Amazon Sagemaker_AWSPSSummit_Singapore
 
Accelerate Machine Learning with Ease Using Amazon SageMaker - BDA301 - Chica...
Accelerate Machine Learning with Ease Using Amazon SageMaker - BDA301 - Chica...Accelerate Machine Learning with Ease Using Amazon SageMaker - BDA301 - Chica...
Accelerate Machine Learning with Ease Using Amazon SageMaker - BDA301 - Chica...
 
Intelligence of Things: IoT, AWS DeepLens and Amazon SageMaker - AWS Summit S...
Intelligence of Things: IoT, AWS DeepLens and Amazon SageMaker - AWS Summit S...Intelligence of Things: IoT, AWS DeepLens and Amazon SageMaker - AWS Summit S...
Intelligence of Things: IoT, AWS DeepLens and Amazon SageMaker - AWS Summit S...
 
Serverless AI with Scikit-Learn (GPSWS405) - AWS re:Invent 2018
Serverless AI with Scikit-Learn (GPSWS405) - AWS re:Invent 2018Serverless AI with Scikit-Learn (GPSWS405) - AWS re:Invent 2018
Serverless AI with Scikit-Learn (GPSWS405) - AWS re:Invent 2018
 
Accelerate Machine Learning with Ease using Amazon SageMaker
Accelerate Machine Learning with Ease using Amazon SageMakerAccelerate Machine Learning with Ease using Amazon SageMaker
Accelerate Machine Learning with Ease using Amazon SageMaker
 
Quickly and easily build, train, and deploy machine learning models at any scale
Quickly and easily build, train, and deploy machine learning models at any scaleQuickly and easily build, train, and deploy machine learning models at any scale
Quickly and easily build, train, and deploy machine learning models at any scale
 
Demystifying Machine Learning On AWS - AWS Summit Sydney 2018
Demystifying Machine Learning On AWS - AWS Summit Sydney 2018Demystifying Machine Learning On AWS - AWS Summit Sydney 2018
Demystifying Machine Learning On AWS - AWS Summit Sydney 2018
 
End to End Model Development to Deployment using SageMaker
End to End Model Development to Deployment using SageMakerEnd to End Model Development to Deployment using SageMaker
End to End Model Development to Deployment using SageMaker
 
Supercharge Your Machine Learning Model with Amazon SageMaker
Supercharge Your Machine Learning Model with Amazon SageMakerSupercharge Your Machine Learning Model with Amazon SageMaker
Supercharge Your Machine Learning Model with Amazon SageMaker
 
AWS Machine Learning Week SF: End to End Model Development Using SageMaker
AWS Machine Learning Week SF: End to End Model Development Using SageMakerAWS Machine Learning Week SF: End to End Model Development Using SageMaker
AWS Machine Learning Week SF: End to End Model Development Using SageMaker
 
Machine learning for developers & data scientists with Amazon SageMaker - AIM...
Machine learning for developers & data scientists with Amazon SageMaker - AIM...Machine learning for developers & data scientists with Amazon SageMaker - AIM...
Machine learning for developers & data scientists with Amazon SageMaker - AIM...
 
AI & Machine Learning at AWS - An Introduction
AI & Machine Learning at AWS - An IntroductionAI & Machine Learning at AWS - An Introduction
AI & Machine Learning at AWS - An Introduction
 
Building Deep Learning Applications with TensorFlow and SageMaker on AWS - Te...
Building Deep Learning Applications with TensorFlow and SageMaker on AWS - Te...Building Deep Learning Applications with TensorFlow and SageMaker on AWS - Te...
Building Deep Learning Applications with TensorFlow and SageMaker on AWS - Te...
 
Integrating Amazon SageMaker into your Enterprise - AWS Online Tech Talks
Integrating Amazon SageMaker into your Enterprise - AWS Online Tech TalksIntegrating Amazon SageMaker into your Enterprise - AWS Online Tech Talks
Integrating Amazon SageMaker into your Enterprise - AWS Online Tech Talks
 
Machine Learning e Amazon SageMaker: Algoritmos, Modelos e Inferências - MCL...
Machine Learning e Amazon SageMaker: Algoritmos, Modelos e Inferências -  MCL...Machine Learning e Amazon SageMaker: Algoritmos, Modelos e Inferências -  MCL...
Machine Learning e Amazon SageMaker: Algoritmos, Modelos e Inferências - MCL...
 
CI/CD for Your Machine Learning Pipeline with Amazon SageMaker (DVC303) - AWS...
CI/CD for Your Machine Learning Pipeline with Amazon SageMaker (DVC303) - AWS...CI/CD for Your Machine Learning Pipeline with Amazon SageMaker (DVC303) - AWS...
CI/CD for Your Machine Learning Pipeline with Amazon SageMaker (DVC303) - AWS...
 

More from Amazon Web Services

Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
Amazon Web Services
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
Amazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
Amazon Web Services
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
Amazon Web Services
 

More from Amazon Web Services (20)

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
 
Fundraising Essentials
Fundraising EssentialsFundraising Essentials
Fundraising Essentials
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
 

Build Machine Learning Applications with AWS Lambda & Amazon SageMaker (SRV420-R1) - AWS re:Invent 2018

  • 1.
  • 2. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Build Machine Learning Applications with AWS Lambda & Amazon SageMaker Diego Natali Solutions Architect Amazon Web Services EMEA S R V 4 2 0 Giuseppe Angelo Porcelli Sr. Solutions Architect Amazon Web Services EMEA
  • 3. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Repeats Friday, 30 SRV420-R1 Build Machine Learning Applications with AWS Lambda & Amazon SageMaker 10:45 – AM | Venetian, Level 4, Lando 4304
  • 4. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. THE MACHINE LEARNING PROCESS Business Problem - ML problem framing
  • 5. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. THE MACHINE LEARNING PROCESS Business Problem - ML problem framing Data Collection Data Integration Data Preparation & Cleaning
  • 6. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. THE MACHINE LEARNING PROCESS Data Visualization & Analysis Business Problem - ML problem framing Data Collection Data Integration Data Preparation & Cleaning Feature Engineering Model Training & Parameter Tuning Model Evaluation Experiment, Train, Tune and Evaluate • Setup and manage Notebook Environments • Setup and manage Training Clusters • Write Data Connectors • Scale ML algorithms to large datasets • Distribute ML training algorithm to multiple machines • Secure Model artifacts
  • 7. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. THE MACHINE LEARNING PROCESS Data Visualization & Analysis Business Problem - ML problem framing Data Collection Data Integration Data Preparation & Cleaning Feature Engineering Are Business goals met? Monitoring & Debugging - Predictions Yes Re-training Model Training & Parameter Tuning Model Evaluation Model Deployment Deploy, Monitor and Debug • Setup and manage Model Inference Clusters • Manage and Auto-Scale Model Inference APIs • Monitor and Debug Model Predictions • Models versioning and performance tracking • Automate New Model version promotion to production (A/B testing)
  • 8. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. THE MACHINE LEARNING PROCESS Data Visualization & Analysis Business Problem - ML problem framing Data Collection Data Integration Data Preparation & Cleaning Feature Engineering Are Business goals met? Monitoring & Debugging - Predictions YesNo DataAugmentation Feature Augmentation Re-training Model Training & Parameter Tuning Model Evaluation Model Deployment
  • 9. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. WHERE SHOULD WE SPEND TIME? BUI L D T R AI N D E P L O Y T U NE
  • 10. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. AMAZON SAGEMAKER End-to-end encryption with KMS End-to-end VPC support Compliance and audit capabilities Metadata and experiment management capabilities Pay as you go Fully managed hosting with auto- scaling One-click deployment Pre-built notebooks for common problems Built-in, high performance algorithms One-click training BUI L D T R AI N & T UNE D E P L O Y Hyperparameter optimization
  • 11. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. EXECUTING INFERENCES Amazon SageMaker Deployment AWS Lambda Real-time Sync Use managed real-time inference cluster On-demand request-based model Real-time Async Use Amazon Kinesis and AWS Lambda to invoke the real-time inference endpoint Use Amazon Kinesis and AWS Lambda to host the model and execute inferences in Lambda Batch Use batch transform Need to implement batch processing Edge (AWS Greengrass) Use built-in AWS Greengrass model hosting Deploy a Lambda function on AWS Greengrass to execute inferences
  • 12. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. USING AWS LAMBDA PROS Develop Modern Applications serverless Charged per request and execution duration Effortless, limitless scalability, high availability, fault tolerance, etc. Lower the cost of inferences No infrastructure to maintain 1 million free executions Event-based model Example: 100M requests for about $54/month CONS GPU not yet available 512 MB /tmp limit 250 MB limit for uncompressed size of code/dependencies Need to create your deployment package and pipeline to automate the process Cold start (~5s TF, ~2s MXNet) Infrastructure to mantain if not using Amazon SageMaker for training Need to include and manage all dependencies Need to create your own API for serving
  • 13. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. AMAZON SAGEMAKER vs AWS LAMBDA Amazon SageMaker Deployment AWS Lambda Workload Well suited for constant and predictable workloads, with regular and frequent traffic Well suited for variable or unpredictable workloads, with intermittent and spiky traffic Scaling Configure auto-scaling on the real-time endpoint Automatic scaling Hardware GPU and CPU instances CPU only Model architecture Any complexity [CNNs, RNNs, etc.] Simple models A/B Testing Yes Yes Deployment Fast, one-click deployment Need to build package and create inference API from scratch Monitoring and Debugging Amazon CloudWatch / CloudWatch Logs Amazon CloudWatch / CloudWatch Logs
  • 14. IT’S A MATTER OF CHOICE
  • 15. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 16. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. THE DATASET SMS Spam Collection Data Set • A public set of 5574 SMS labeled messages that have been collected for mobile phone spam research • 747 SPAM, 4827 non SPAM https://archive.ics.uci.edu/ml/datasets/sms+spam+collection ham Go until jurong point, crazy.. Available only in bugis n great world la e buffet... Cine there got amore wat... ham Ok lar... Joking wif u oni... spam Free entry in 2 a wkly comp to win FA Cup final tkts 21st May 2005. Text FA to 87121 to receive entry question(std txt rate)T&C's apply 08452810075over18’s ham U dun say so early hor... U c already then say... ham Nah I don't think he goes to usf, he lives around here though spam FreeMsg Hey there darling it's been 3 week's now and no word back! I'd like some fun you up for it still? Tb ok! XxX std chgs to send, £1.50 to rcv ham Even my brother is not like to speak with me. They treat me like aids patent. ham As per your request 'Melle Melle (Oru Minnaminunginte Nurungu Vettam)' has been set as your callertune for all Callers. Press *9 to copy your friends Callertune
  • 17. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. WORKFLOW BUI L D T R AI N & T UNE D E P L O Y
  • 18. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. TRAINING THE MODEL LINK TO NOTEBOOK
  • 19. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. DEPLOYING TO LAMBDA Get model artifacts from S3 Run an Amazon Linux EC2 Instance or Cloud9 environment Download pre-built TF/MXNet Lambda packages from GitHub in a folder Write Lambda handler, package and save Lambda deployment package to S3 Copy model artifacts in the folder https://docs.aws.amazon.com/sagemaker/latest/dg/API_ModelArtifacts.html https://docs.aws.amazon.com/cloud9/latest/user-guide/welcome.html https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EC2_GetStarted.html https://github.com/awslabs/mxnet-lambda https://github.com/ryfeus/lambda-packs https://docs.aws.amazon.com/lambda/latest/dg/lambda-python- how-to-create-deployment-package.html
  • 20. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. LAMBDA COLD START
  • 21. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. AUTOMATING DEPLOYMENT AWS CodePipeline bucket with objects event (event- based) AWS CloudTrail Lambda function bucket with objects event (event- based) AWS CloudTrail Amazon SageMaker AWS CodeBuild template stack change set bucket with objects Amazon API Gateway* Lambda function AWS CodeDeploy Hook Lambda function Checker
  • 22. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 23. Thank you! © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Diego Natali dnnatali@amazon.it Giuseppe Angelo Porcelli gianpo@amazon.it
  • 24. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.