SlideShare a Scribd company logo
1 of 20
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Vikram Madan, Sr. Product Manager
November 14, 2017
Sentiment Analysis Using
Apache MXNet and Gluon
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Sentiment analysis
Sentiment analysis is a natural language processing (NLP) task for classifying
text or speech as some specified sentiment
Brand Sentiment Political Sentiment Customer Satisfaction
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Performing sentiment analysis
Labelled Data
for Training
Word
Embedding
Train Deep
Neural Network
Deploy Model
for Prediction
Focus of Today’s Discussion
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
IMBD dataset for movie reviews
Positive
“The impetuous pace of the film
is at one with its moral
shamelessness, and, without
thinking, we sign up for both”
“What a magical movie”
“It is a film so awe-inspiringly
wooden that it’s basically a fire-risk”
“An explosion in a stupid factory”
“Love him, hated Hur”
Negative
25,000 movie reviews: 12,500 positive & 12,500 negative
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Converting words to vectors
Two Major Approaches: word2vec & GloVe
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Converting words to vectors
Training Co-Occurrence Data Output Vectors
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Converting words to vectors
Example: 3-Dimensional Word Vectors
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
GloVe: Global Vectors for Word Representation
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Deep Neural Networks
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Recurrent Neural Networks (RNNs)
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Long Short-Term Memory (LSTM) networks
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Illustrative Example (Part 1 of 2)
Edwin Chen Blog (http://blog.echen.me/)
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Illustrative Example (Part 2 of 2)
Edwin Chen Blog (http://blog.echen.me/)
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Gluon API Specification
Gluon is a technical specification providing a programming
interface that: (1) simplifies development of deep learning models,
(2) provides greater flexibility in building neural networks, and (3)
offers high performance
Simplicity Flexibility Performance
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Gluon API is Available in Apache MXNet
Others…
Development of the Gluon API specification was
a collaboration between AWS and Microsoft
Available Now
Coming Soon
Gluon API is implemented in Apache
MXNet and soon will be in CNTK
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Advantages of the Gluon API
Simple, Easy-to-
Understand Code
Flexible, Imperative
Structure
Dynamic Graphs
High Performance
 Neural networks can be defined using simple, clear, concise code
 Plug-and-play neural network building blocks – including predefined layers,
optimizers, and initializers
 Eliminates rigidity of neural network model definition and brings together
the model with the training algorithm
 Intuitive, easy-to-debug, familiar code
 Neural networks can change in shape or size during the training process to
address advanced use cases where the size of data fed is variable
 Important area of innovation in Natural Language Processing (NLP)
 There is no sacrifice with respect to training speed
 When it is time to move from prototyping to production, easily cache neural
networks for high performance and a reduced memory footprint
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Simple, Easy-to-Understand Code
Use plug-and-play neural network building blocks, including
predefined layers, optimizers, and initializers
# First step is to initialize your model
net = gluon.nn.Sequential()
# Then, define your model architecture
with net.name_scope():
net.add(gluon.nn.Dense(256, activation="relu")) # 1st layer (256 nodes)
net.add(gluon.nn.Dense(256, activation="relu")) # 2nd hidden layer
net.add(gluon.nn.Dense(num_outputs)) # Output layer
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Flexible, Imperative Structure
Prototype, build, and debug neural networks more easily with a
fully imperative interface
epochs = 10
for e in range(epochs):
for i, batch in enumerate(train_data):
with autograd.record(): # Start recording the derivatives
output = net(data) # the forward iteration
loss = softmax_cross_entropy(output, label)
loss.backward()
trainer.step(data.shape[0])
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Dynamic Graphs
Build neural networks on the fly for use cases where neural
networks must change in size and shape during model training
def forward(self, F, inputs, tree):
children_outputs = [self.forward(F, inputs, child)
for child in tree.children]
#Recursively builds the neural network based on each input sentence’s
#syntactic structure during the model definition and training process
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
High Performance
Easily cache the neural network to achieve high performance
when speed becomes more important than flexibility
net = nn.HybridSequential()
with net.name_scope():
net.add(nn.Dense(256, activation="relu"))
net.add(nn.Dense(128, activation="relu"))
net.add(nn.Dense(2))
net.hybridize()

More Related Content

What's hot

What's hot (20)

NEW LAUNCH! Introducing Amazon SageMaker - MCL365 - re:Invent 2017
NEW LAUNCH! Introducing Amazon SageMaker - MCL365 - re:Invent 2017NEW LAUNCH! Introducing Amazon SageMaker - MCL365 - re:Invent 2017
NEW LAUNCH! Introducing Amazon SageMaker - MCL365 - re:Invent 2017
 
Machine Learning State of the Union - MCL210 - re:Invent 2017
Machine Learning State of the Union - MCL210 - re:Invent 2017Machine Learning State of the Union - MCL210 - re:Invent 2017
Machine Learning State of the Union - MCL210 - re:Invent 2017
 
NEW LAUNCH! Amazon Rekognition Video eliminates manual cataloging of video wh...
NEW LAUNCH! Amazon Rekognition Video eliminates manual cataloging of video wh...NEW LAUNCH! Amazon Rekognition Video eliminates manual cataloging of video wh...
NEW LAUNCH! Amazon Rekognition Video eliminates manual cataloging of video wh...
 
WPS205_Is AWS GovCloud Right for your Regulated Workload
WPS205_Is AWS GovCloud Right for your Regulated WorkloadWPS205_Is AWS GovCloud Right for your Regulated Workload
WPS205_Is AWS GovCloud Right for your Regulated Workload
 
NEW LAUNCH! How to build graph applications with SPARQL and Gremlin using Ama...
NEW LAUNCH! How to build graph applications with SPARQL and Gremlin using Ama...NEW LAUNCH! How to build graph applications with SPARQL and Gremlin using Ama...
NEW LAUNCH! How to build graph applications with SPARQL and Gremlin using Ama...
 
NEW LAUNCH! Driving Dynamically Animated Characters in VR/AR Applications Usi...
NEW LAUNCH! Driving Dynamically Animated Characters in VR/AR Applications Usi...NEW LAUNCH! Driving Dynamically Animated Characters in VR/AR Applications Usi...
NEW LAUNCH! Driving Dynamically Animated Characters in VR/AR Applications Usi...
 
ENT301_Real-World AI For the Enterprise
ENT301_Real-World AI For the EnterpriseENT301_Real-World AI For the Enterprise
ENT301_Real-World AI For the Enterprise
 
RET305-Turbo Charge Your E-Commerce Site wAmazon Cache and Search Solutions.pdf
RET305-Turbo Charge Your E-Commerce Site wAmazon Cache and Search Solutions.pdfRET305-Turbo Charge Your E-Commerce Site wAmazon Cache and Search Solutions.pdf
RET305-Turbo Charge Your E-Commerce Site wAmazon Cache and Search Solutions.pdf
 
NEW LAUNCH! Push Intelligence to the edge with Greengrass - IOT209 - re:Inven...
NEW LAUNCH! Push Intelligence to the edge with Greengrass - IOT209 - re:Inven...NEW LAUNCH! Push Intelligence to the edge with Greengrass - IOT209 - re:Inven...
NEW LAUNCH! Push Intelligence to the edge with Greengrass - IOT209 - re:Inven...
 
NEW LAUNCH! Amazon EC2 Bare Metal Instances - CMP330 - re:Invent 2017
NEW LAUNCH! Amazon EC2 Bare Metal Instances - CMP330 - re:Invent 2017NEW LAUNCH! Amazon EC2 Bare Metal Instances - CMP330 - re:Invent 2017
NEW LAUNCH! Amazon EC2 Bare Metal Instances - CMP330 - re:Invent 2017
 
GPSBUS205_Power to the People- Amazon Connect
GPSBUS205_Power to the People- Amazon ConnectGPSBUS205_Power to the People- Amazon Connect
GPSBUS205_Power to the People- Amazon Connect
 
GPSTEC321_VMware on AWS Cloud Technical Deep Dive & Native AWS Services Integ...
GPSTEC321_VMware on AWS Cloud Technical Deep Dive & Native AWS Services Integ...GPSTEC321_VMware on AWS Cloud Technical Deep Dive & Native AWS Services Integ...
GPSTEC321_VMware on AWS Cloud Technical Deep Dive & Native AWS Services Integ...
 
An Introduction to AWS IoT - Web Summit Lisbon
An Introduction to AWS IoT - Web Summit LisbonAn Introduction to AWS IoT - Web Summit Lisbon
An Introduction to AWS IoT - Web Summit Lisbon
 
LFS309-High-Throughput Genomics on AWS.pdf
LFS309-High-Throughput Genomics on AWS.pdfLFS309-High-Throughput Genomics on AWS.pdf
LFS309-High-Throughput Genomics on AWS.pdf
 
DynamoDB adaptive capacity: smooth performance for chaotic workloads - DAT327...
DynamoDB adaptive capacity: smooth performance for chaotic workloads - DAT327...DynamoDB adaptive capacity: smooth performance for chaotic workloads - DAT327...
DynamoDB adaptive capacity: smooth performance for chaotic workloads - DAT327...
 
GPSTEC302_Anti-Patterns- Learning through Failure
GPSTEC302_Anti-Patterns- Learning through FailureGPSTEC302_Anti-Patterns- Learning through Failure
GPSTEC302_Anti-Patterns- Learning through Failure
 
10 Lessons from 10 Years of AWS
10 Lessons from 10 Years of AWS10 Lessons from 10 Years of AWS
10 Lessons from 10 Years of AWS
 
MCL301_Building a Voice-Enabled Customer Service Chatbot Using Amazon Lex and...
MCL301_Building a Voice-Enabled Customer Service Chatbot Using Amazon Lex and...MCL301_Building a Voice-Enabled Customer Service Chatbot Using Amazon Lex and...
MCL301_Building a Voice-Enabled Customer Service Chatbot Using Amazon Lex and...
 
NEW LAUNCH! Hear how the Pac-12 is using AWS Elemental MediaStore and explore...
NEW LAUNCH! Hear how the Pac-12 is using AWS Elemental MediaStore and explore...NEW LAUNCH! Hear how the Pac-12 is using AWS Elemental MediaStore and explore...
NEW LAUNCH! Hear how the Pac-12 is using AWS Elemental MediaStore and explore...
 
Journey Towards Scaling Your API to 10 Million Users
Journey Towards Scaling Your API to 10 Million UsersJourney Towards Scaling Your API to 10 Million Users
Journey Towards Scaling Your API to 10 Million Users
 

Viewers also liked

Viewers also liked (20)

Disaster Recovery Options with AWS - AWS Online Tech Talks
Disaster Recovery Options with AWS - AWS Online Tech TalksDisaster Recovery Options with AWS - AWS Online Tech Talks
Disaster Recovery Options with AWS - AWS Online Tech Talks
 
Building Serverless Websites with Lambda@Edge - AWS Online Tech Talks
Building Serverless Websites with Lambda@Edge - AWS Online Tech TalksBuilding Serverless Websites with Lambda@Edge - AWS Online Tech Talks
Building Serverless Websites with Lambda@Edge - AWS Online Tech Talks
 
Essential Capabilities of an IoT Cloud Platform - AWS Online Tech Talks
Essential Capabilities of an IoT Cloud Platform - AWS Online Tech TalksEssential Capabilities of an IoT Cloud Platform - AWS Online Tech Talks
Essential Capabilities of an IoT Cloud Platform - AWS Online Tech Talks
 
Bringing Characters to Life with Amazon Polly Text-to-Speech - AWS Online Tec...
Bringing Characters to Life with Amazon Polly Text-to-Speech - AWS Online Tec...Bringing Characters to Life with Amazon Polly Text-to-Speech - AWS Online Tec...
Bringing Characters to Life with Amazon Polly Text-to-Speech - AWS Online Tec...
 
Hands on Lab: Deploy .NET Code to AWS from Visual Studio - AWS Online Tech Talks
Hands on Lab: Deploy .NET Code to AWS from Visual Studio - AWS Online Tech TalksHands on Lab: Deploy .NET Code to AWS from Visual Studio - AWS Online Tech Talks
Hands on Lab: Deploy .NET Code to AWS from Visual Studio - AWS Online Tech Talks
 
AWS Step Functions - Dev lounge Express Edition.pdf
AWS Step Functions - Dev lounge Express Edition.pdfAWS Step Functions - Dev lounge Express Edition.pdf
AWS Step Functions - Dev lounge Express Edition.pdf
 
Cost Optimisation on AWS
Cost Optimisation on AWSCost Optimisation on AWS
Cost Optimisation on AWS
 
9 Security Best Practices
9 Security Best Practices9 Security Best Practices
9 Security Best Practices
 
WKS401 Deploy a Deep Learning Framework on Amazon ECS and EC2 Spot Instances
WKS401 Deploy a Deep Learning Framework on Amazon ECS and EC2 Spot InstancesWKS401 Deploy a Deep Learning Framework on Amazon ECS and EC2 Spot Instances
WKS401 Deploy a Deep Learning Framework on Amazon ECS and EC2 Spot Instances
 
Licensing Windows Workloads on AWS - AWS Online Tech Talks
Licensing Windows Workloads on AWS - AWS Online Tech TalksLicensing Windows Workloads on AWS - AWS Online Tech Talks
Licensing Windows Workloads on AWS - AWS Online Tech Talks
 
Know Before You Go - AWS Online Tech Talks
Know Before You Go - AWS Online Tech TalksKnow Before You Go - AWS Online Tech Talks
Know Before You Go - AWS Online Tech Talks
 
AWS Cloud Migration Insights Forum
AWS Cloud Migration Insights ForumAWS Cloud Migration Insights Forum
AWS Cloud Migration Insights Forum
 
Intro to Amazon AI Services
Intro to Amazon AI ServicesIntro to Amazon AI Services
Intro to Amazon AI Services
 
Reactive Architectures with Microservices
Reactive Architectures with MicroservicesReactive Architectures with Microservices
Reactive Architectures with Microservices
 
Becoming a Command Line Expert with the AWS CLI (TLS304) | AWS re:Invent 2013
Becoming a Command Line Expert with the AWS CLI (TLS304) | AWS re:Invent 2013Becoming a Command Line Expert with the AWS CLI (TLS304) | AWS re:Invent 2013
Becoming a Command Line Expert with the AWS CLI (TLS304) | AWS re:Invent 2013
 
AWS re:Invent 2016: The Effective AWS CLI User (DEV402)
AWS re:Invent 2016: The Effective AWS CLI User (DEV402)AWS re:Invent 2016: The Effective AWS CLI User (DEV402)
AWS re:Invent 2016: The Effective AWS CLI User (DEV402)
 
(DEV301) Automating AWS with the AWS CLI
(DEV301) Automating AWS with the AWS CLI(DEV301) Automating AWS with the AWS CLI
(DEV301) Automating AWS with the AWS CLI
 
Managing Container Images with Amazon ECR - AWS Online Tech Talks
Managing Container Images with Amazon ECR - AWS Online Tech TalksManaging Container Images with Amazon ECR - AWS Online Tech Talks
Managing Container Images with Amazon ECR - AWS Online Tech Talks
 
NVIDIA SAP Sapphire 2017 Show Guide
NVIDIA SAP Sapphire 2017 Show Guide NVIDIA SAP Sapphire 2017 Show Guide
NVIDIA SAP Sapphire 2017 Show Guide
 
Running Containerised Applications at Scale on AWS
Running Containerised Applications at Scale on AWSRunning Containerised Applications at Scale on AWS
Running Containerised Applications at Scale on AWS
 

Similar to Sentiment Analysis Using Apache MXNet and Gluon - AWS Online Tech Talks

Similar to Sentiment Analysis Using Apache MXNet and Gluon - AWS Online Tech Talks (20)

MCL303-Deep Learning with Apache MXNet and Gluon
MCL303-Deep Learning with Apache MXNet and GluonMCL303-Deep Learning with Apache MXNet and Gluon
MCL303-Deep Learning with Apache MXNet and Gluon
 
Maschinelles Lernen auf AWS für Entwickler, Data Scientists und Experten
Maschinelles Lernen auf AWS für Entwickler, Data Scientists und ExpertenMaschinelles Lernen auf AWS für Entwickler, Data Scientists und Experten
Maschinelles Lernen auf AWS für Entwickler, Data Scientists und Experten
 
What is deep learning (and why you should care) - Talk at SJSU Oct 2018
What is deep learning (and why you should care) - Talk at SJSU Oct 2018What is deep learning (and why you should care) - Talk at SJSU Oct 2018
What is deep learning (and why you should care) - Talk at SJSU Oct 2018
 
Debugging and Performance tricks for MXNet Gluon
Debugging and Performance tricks for MXNet GluonDebugging and Performance tricks for MXNet Gluon
Debugging and Performance tricks for MXNet Gluon
 
AI / ML Services - re:Invent Comes to London 2.0
AI / ML Services - re:Invent Comes to London 2.0AI / ML Services - re:Invent Comes to London 2.0
AI / ML Services - re:Invent Comes to London 2.0
 
Emotion Recognition in Images
Emotion Recognition in ImagesEmotion Recognition in Images
Emotion Recognition in Images
 
MCL310_Building Deep Learning Applications with Apache MXNet and Gluon
MCL310_Building Deep Learning Applications with Apache MXNet and GluonMCL310_Building Deep Learning Applications with Apache MXNet and Gluon
MCL310_Building Deep Learning Applications with Apache MXNet and Gluon
 
Model Serving for Deep Learning
Model Serving for Deep LearningModel Serving for Deep Learning
Model Serving for Deep Learning
 
Artificial Intelligence (Machine Learning) on AWS: How to Start
Artificial Intelligence (Machine Learning) on AWS: How to StartArtificial Intelligence (Machine Learning) on AWS: How to Start
Artificial Intelligence (Machine Learning) on AWS: How to Start
 
Accelerating Apache MXNet Models on Apple Platforms Using Core ML - MCL311 - ...
Accelerating Apache MXNet Models on Apple Platforms Using Core ML - MCL311 - ...Accelerating Apache MXNet Models on Apple Platforms Using Core ML - MCL311 - ...
Accelerating Apache MXNet Models on Apple Platforms Using Core ML - MCL311 - ...
 
Artificial Intelligence (Machine Learning) on AWS: How to Start
Artificial Intelligence (Machine Learning) on AWS: How to StartArtificial Intelligence (Machine Learning) on AWS: How to Start
Artificial Intelligence (Machine Learning) on AWS: How to Start
 
Time series modeling workd AMLD 2018 Lausanne
Time series modeling workd AMLD 2018 LausanneTime series modeling workd AMLD 2018 Lausanne
Time series modeling workd AMLD 2018 Lausanne
 
DEV325_Application Deployment Techniques for Amazon EC2 Workloads with AWS Co...
DEV325_Application Deployment Techniques for Amazon EC2 Workloads with AWS Co...DEV325_Application Deployment Techniques for Amazon EC2 Workloads with AWS Co...
DEV325_Application Deployment Techniques for Amazon EC2 Workloads with AWS Co...
 
New AI/ML services at AWS re:Invent 2017
New AI/ML services at AWS re:Invent 2017New AI/ML services at AWS re:Invent 2017
New AI/ML services at AWS re:Invent 2017
 
透過最新的 AWS 服務在 2019 年為您的業務轉型 (Level 200)
透過最新的 AWS 服務在 2019 年為您的業務轉型 (Level 200)透過最新的 AWS 服務在 2019 年為您的業務轉型 (Level 200)
透過最新的 AWS 服務在 2019 年為您的業務轉型 (Level 200)
 
Building Your Smart Applications with Amazon AI.pdf
Building Your Smart Applications with Amazon AI.pdfBuilding Your Smart Applications with Amazon AI.pdf
Building Your Smart Applications with Amazon AI.pdf
 
Rethink Your Graphics Workstation Strategy with Amazon AppStream 2.0 - BAP311...
Rethink Your Graphics Workstation Strategy with Amazon AppStream 2.0 - BAP311...Rethink Your Graphics Workstation Strategy with Amazon AppStream 2.0 - BAP311...
Rethink Your Graphics Workstation Strategy with Amazon AppStream 2.0 - BAP311...
 
LFS301-SAGE Bionetworks, Digital Mammography DREAM Challenge and How AWS Enab...
LFS301-SAGE Bionetworks, Digital Mammography DREAM Challenge and How AWS Enab...LFS301-SAGE Bionetworks, Digital Mammography DREAM Challenge and How AWS Enab...
LFS301-SAGE Bionetworks, Digital Mammography DREAM Challenge and How AWS Enab...
 
GluonCV
GluonCVGluonCV
GluonCV
 
Machine Learning Models with Apache MXNet and AWS Fargate
Machine Learning Models with Apache MXNet and AWS FargateMachine Learning Models with Apache MXNet and AWS Fargate
Machine Learning Models with Apache MXNet and AWS Fargate
 

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
 

Sentiment Analysis Using Apache MXNet and Gluon - AWS Online Tech Talks

  • 1. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Vikram Madan, Sr. Product Manager November 14, 2017 Sentiment Analysis Using Apache MXNet and Gluon
  • 2. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Sentiment analysis Sentiment analysis is a natural language processing (NLP) task for classifying text or speech as some specified sentiment Brand Sentiment Political Sentiment Customer Satisfaction
  • 3. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Performing sentiment analysis Labelled Data for Training Word Embedding Train Deep Neural Network Deploy Model for Prediction Focus of Today’s Discussion
  • 4. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. IMBD dataset for movie reviews Positive “The impetuous pace of the film is at one with its moral shamelessness, and, without thinking, we sign up for both” “What a magical movie” “It is a film so awe-inspiringly wooden that it’s basically a fire-risk” “An explosion in a stupid factory” “Love him, hated Hur” Negative 25,000 movie reviews: 12,500 positive & 12,500 negative
  • 5. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Converting words to vectors Two Major Approaches: word2vec & GloVe
  • 6. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Converting words to vectors Training Co-Occurrence Data Output Vectors
  • 7. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Converting words to vectors Example: 3-Dimensional Word Vectors
  • 8. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. GloVe: Global Vectors for Word Representation
  • 9. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Deep Neural Networks
  • 10. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Recurrent Neural Networks (RNNs)
  • 11. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Long Short-Term Memory (LSTM) networks
  • 12. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Illustrative Example (Part 1 of 2) Edwin Chen Blog (http://blog.echen.me/)
  • 13. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Illustrative Example (Part 2 of 2) Edwin Chen Blog (http://blog.echen.me/)
  • 14. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Gluon API Specification Gluon is a technical specification providing a programming interface that: (1) simplifies development of deep learning models, (2) provides greater flexibility in building neural networks, and (3) offers high performance Simplicity Flexibility Performance
  • 15. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Gluon API is Available in Apache MXNet Others… Development of the Gluon API specification was a collaboration between AWS and Microsoft Available Now Coming Soon Gluon API is implemented in Apache MXNet and soon will be in CNTK
  • 16. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Advantages of the Gluon API Simple, Easy-to- Understand Code Flexible, Imperative Structure Dynamic Graphs High Performance  Neural networks can be defined using simple, clear, concise code  Plug-and-play neural network building blocks – including predefined layers, optimizers, and initializers  Eliminates rigidity of neural network model definition and brings together the model with the training algorithm  Intuitive, easy-to-debug, familiar code  Neural networks can change in shape or size during the training process to address advanced use cases where the size of data fed is variable  Important area of innovation in Natural Language Processing (NLP)  There is no sacrifice with respect to training speed  When it is time to move from prototyping to production, easily cache neural networks for high performance and a reduced memory footprint
  • 17. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Simple, Easy-to-Understand Code Use plug-and-play neural network building blocks, including predefined layers, optimizers, and initializers # First step is to initialize your model net = gluon.nn.Sequential() # Then, define your model architecture with net.name_scope(): net.add(gluon.nn.Dense(256, activation="relu")) # 1st layer (256 nodes) net.add(gluon.nn.Dense(256, activation="relu")) # 2nd hidden layer net.add(gluon.nn.Dense(num_outputs)) # Output layer
  • 18. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Flexible, Imperative Structure Prototype, build, and debug neural networks more easily with a fully imperative interface epochs = 10 for e in range(epochs): for i, batch in enumerate(train_data): with autograd.record(): # Start recording the derivatives output = net(data) # the forward iteration loss = softmax_cross_entropy(output, label) loss.backward() trainer.step(data.shape[0])
  • 19. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Dynamic Graphs Build neural networks on the fly for use cases where neural networks must change in size and shape during model training def forward(self, F, inputs, tree): children_outputs = [self.forward(F, inputs, child) for child in tree.children] #Recursively builds the neural network based on each input sentence’s #syntactic structure during the model definition and training process
  • 20. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. High Performance Easily cache the neural network to achieve high performance when speed becomes more important than flexibility net = nn.HybridSequential() with net.name_scope(): net.add(nn.Dense(256, activation="relu")) net.add(nn.Dense(128, activation="relu")) net.add(nn.Dense(2)) net.hybridize()