Deep Learning for NLP

Amit Kapoor
Amit KapoorCrafting Visual Stories with Data
Deep Learning
for Natural Language Processing
  
   
Bargava Subramanian @bargava
Amit Kapoor @amitkaps
1
Language Challenge
2
Put these adjectives in order: [adj.] + [Knife]
— old
— French
— lovely
— green
— rectangular
— whittling
— silver
— little
3
Which order is correct?
lovely old silver rectangular green little French
whittling knife
old lovely French rectangular green little
whittling silver knife
lovely little old rectangular green French silver
whittling knife
4
Grammar has rules
opinion - size - age - shape - colour -
origin -material - purpose [Noun]
The right version:
lovely little old rectangular green French silver
whittling knife
5
We speak the grammar, yet we don't know it
6
Natural Language
Problems are hard
7
Natural Language Programming Problems
— Summarization
— Text Classification (e.g. spam)
— Sentiment / Emotion Analysis
— Topic Modelling
— Recommendations
— Text Evaluation (e.g. grading)
8
Plan for this Session
— Moving beyond Statistical Learning
— Take first steps in NLP with Deep
Learning
— Showcase an example
— Practical challenges to overcome
9
NLP Learning Process
___
[1] Frame: Problem definition
[2] Acquire: Text ingestion
[3] Refine: Text wrangling
[4] Transform: Feature creation
[5] Explore: Feature selection
[6] Model: Model selection
[7] Insight: Solution communication
10
Simple Case
Demonetisation in India
11
Demonetisation in India
On Nov 8th, 2016, the National Government
announced that existing INR 1000 and INR
500 notes are no longer legal.
12
13
Reactions on Twitter
People started tweeting with the tag:
#demonetisation
14
[1] Frame
Create a viral tweet on
#demonetisation
15
Traditional way of framing
1. Someone has to write a tweet.
2. Run it on the classifier
3. If probability is high, post it.
4. Else, goto step 1
The prediction will be a probability of a new
tweet to go viral or not?
16
Generating tweets
— Can we learn from
historical tweets
algorithmically to
generate a viral tweet?
— Not possible to do using
traditional methods
17
Revised framing for Text Generation
Generate a tweet algorithmically, that is likely
to go viral
18
[2] Acquire
Get the raw tweets data
19
Get Tweets on
#demonetisation
Write your own twitter api
client to get json file or
use a python package like
Tweepy, but need to
manage rate limiting etc.
We used tweezer - an
open source project to get
twitter data
Raw dataset - 30,000+
tweets from past 1 week.
20
[3] Refine
How to categorise a tweet
as viral or not?
21
Simple Approach for Labelling
IF
retweets + favourites > = 100
THEN
Label = viral
ELSE
Label = normal
22
Sanitizing Tweets
— Stopword
— Stemming
— Remove urls
— Remove 'RT'
— Remove 'n'
23
[4] Transform
Creating Features from
Text
24
Traditional methods to covert text to numeric
— TF-IDF: Measures importance of a word
in a document relative to the corpus
— Bag-of-Word: Count of occurrences of a
word in a document
— n-grams: Count of every 1-word, 2-word,
etc combinations in a document
— entity & POS tagging: Transform
sentence to parts-of-speech, extract
entities and encode
25
Challenges in traditional methods of encoding
— Sparse inputs
— Input data space explodes
— Context lost in encoding
A quiet crowd entered the historic church
!=
A historic crowd entered the quiet church
26
Deep Learning Approach
Low-dimensional dense vectors for
representation.
— Tokenise characters (Faster)
— Tokenise words (More accurate, but needs
more memory)
27
Word Embedding
— Learn high-quality word vectors
— Similar words needs to be close to each
other
— Words can have multiple degrees of
similarity
28
Word Embedding using word2vec
Combines two approaches
— skip-gram: Predicting word given its
context
— continuous bag-of-words: Predicting
context given a word
29
word2vec: Example
vec[queen] − vec[king] = vec[woman] − vec[man]
1
1
https://www.tensorflow.org/versions/r0.12/tutorials/word2vec/index.html
30
[5] Explore
Features Selection
31
Feature Selection
— Manual process in Traditional Approach
— Feature selection happens automatically
in Deep Learning
32
[6] Model
Model Selection
33
Recurrent Neural Network (RNN)
— Network with loops
— Allows information to persist
— Enables connecting previous information
to present task
— Context preserved
I grew up in Brazil and I speak ______________.
                                                        portuguese
34
Unrolling over Time
____
[1] Think sequences - in input & output
    
- Recognize Image -> Explain in words
- Sentence(s) -> Sentiment Analysis
- English - Spanish Translation
- Video - task classification
35
Unrolled RNN
[2] Multiple copies of the same network
[3] Each pass message to its successor
2
2
http://colah.github.io/posts/2015-08-Understanding-LSTMs/
36
Architecture Overview
37
[7] Model
Solution Communication
38
Generated Tweets
39
Deep Learning Challenges
— Data Size: RNN doesn't generalize well
on small datasets
— Relevant Corpus: Required to create
domain specific word embedding
— Deeper Networks: Empirically deeper
networks have better accuracy
— Training Time: RNNs take a long time to
learn.
40
Use case: Chat Bots
— Bookings
— Customer Support
— Help Desk Automation
— ...
41
Tools to get started: Software
Python Stack
- Use spacy for NLP preprocessing
- Use gensim for word2vec training
- Start with keras
- Have tensorflow as backend
Use pre-trained models like word2vec for
word embedding and similarly for RNNs
42
Tools to get started: Hardware
Work on GPUs
- Nvidia TitanX (suitable for consumers)
- Tesla K80 (suitable for professionals)
For detailed hardware choices:
http://timdettmers.com/2015/03/09/deep-
learning-hardware-guide/
43
Closing thoughts
44
Reference: Deep Learning for NLP
Notebooks and Material @
https://github.com/rouseguy/
DeepLearningNLP_Py
- What is deep learning?
- Motivation: Some use cases
- Building blocks of Neural Networks (Neuron, Activation Function)
- Backpropagation Algorithm
- Word Embedding
- word2vec
- Introduction to keras
- Multi-layer perceptron
- Convolutional Neural Network
- Recurrent Neural Network
- Challenges in Deep Learning
45
Contact
___
Bargava Subramanian
@bargava
Amit Kapoor
@amitkaps
amitkaps.com
46
1 of 46

Recommended

DataScience Lab 2017_From bag of texts to bag of clusters_Терпиль Евгений / П... by
DataScience Lab 2017_From bag of texts to bag of clusters_Терпиль Евгений / П...DataScience Lab 2017_From bag of texts to bag of clusters_Терпиль Евгений / П...
DataScience Lab 2017_From bag of texts to bag of clusters_Терпиль Евгений / П...GeeksLab Odessa
607 views49 slides
mailfilter.ppt by
mailfilter.pptmailfilter.ppt
mailfilter.pptbutest
652 views46 slides
NLP Bootcamp by
NLP BootcampNLP Bootcamp
NLP BootcampAnuj Gupta
1.6K views289 slides
Anthiil Inside workshop on NLP by
Anthiil Inside workshop on NLPAnthiil Inside workshop on NLP
Anthiil Inside workshop on NLPSatyam Saxena
448 views267 slides
Text Classification by
Text ClassificationText Classification
Text ClassificationRAX Automation Suite
3.3K views27 slides
Exploiting Distributional Semantic Models in Question Answering by
Exploiting Distributional Semantic Models in Question AnsweringExploiting Distributional Semantic Models in Question Answering
Exploiting Distributional Semantic Models in Question AnsweringPierpaolo Basile
941 views37 slides

More Related Content

What's hot

Deep Learning, an interactive introduction for NLP-ers by
Deep Learning, an interactive introduction for NLP-ersDeep Learning, an interactive introduction for NLP-ers
Deep Learning, an interactive introduction for NLP-ersRoelof Pieters
13.7K views83 slides
Abigail See - 2017 - Get To The Point: Summarization with Pointer-Generator N... by
Abigail See - 2017 - Get To The Point: Summarization with Pointer-Generator N...Abigail See - 2017 - Get To The Point: Summarization with Pointer-Generator N...
Abigail See - 2017 - Get To The Point: Summarization with Pointer-Generator N...Association for Computational Linguistics
1.7K views32 slides
[PDF] by
[PDF][PDF]
[PDF]butest
391 views4 slides
(Deep) Neural Networks在 NLP 和 Text Mining 总结 by
(Deep) Neural Networks在 NLP 和 Text Mining 总结(Deep) Neural Networks在 NLP 和 Text Mining 总结
(Deep) Neural Networks在 NLP 和 Text Mining 总结君 廖
16.9K views36 slides
CMSC 723: Computational Linguistics I by
CMSC 723: Computational Linguistics ICMSC 723: Computational Linguistics I
CMSC 723: Computational Linguistics Ibutest
1K views54 slides
Deep Learning Enabled Question Answering System to Automate Corporate Helpdesk by
Deep Learning Enabled Question Answering System to Automate Corporate HelpdeskDeep Learning Enabled Question Answering System to Automate Corporate Helpdesk
Deep Learning Enabled Question Answering System to Automate Corporate HelpdeskSaurabh Saxena
214 views39 slides

What's hot(17)

Deep Learning, an interactive introduction for NLP-ers by Roelof Pieters
Deep Learning, an interactive introduction for NLP-ersDeep Learning, an interactive introduction for NLP-ers
Deep Learning, an interactive introduction for NLP-ers
Roelof Pieters13.7K views
[PDF] by butest
[PDF][PDF]
[PDF]
butest391 views
(Deep) Neural Networks在 NLP 和 Text Mining 总结 by 君 廖
(Deep) Neural Networks在 NLP 和 Text Mining 总结(Deep) Neural Networks在 NLP 和 Text Mining 总结
(Deep) Neural Networks在 NLP 和 Text Mining 总结
君 廖16.9K views
CMSC 723: Computational Linguistics I by butest
CMSC 723: Computational Linguistics ICMSC 723: Computational Linguistics I
CMSC 723: Computational Linguistics I
butest1K views
Deep Learning Enabled Question Answering System to Automate Corporate Helpdesk by Saurabh Saxena
Deep Learning Enabled Question Answering System to Automate Corporate HelpdeskDeep Learning Enabled Question Answering System to Automate Corporate Helpdesk
Deep Learning Enabled Question Answering System to Automate Corporate Helpdesk
Saurabh Saxena214 views
[ppt] by butest
[ppt][ppt]
[ppt]
butest585 views
ADVANCED LSB TECHNIQUE FOR AUDIO STENOGRAPHY by csandit
ADVANCED LSB TECHNIQUE FOR AUDIO STENOGRAPHYADVANCED LSB TECHNIQUE FOR AUDIO STENOGRAPHY
ADVANCED LSB TECHNIQUE FOR AUDIO STENOGRAPHY
csandit36 views
NLP Bootcamp 2018 : Representation Learning of text for NLP by Anuj Gupta
NLP Bootcamp 2018 : Representation Learning of text for NLPNLP Bootcamp 2018 : Representation Learning of text for NLP
NLP Bootcamp 2018 : Representation Learning of text for NLP
Anuj Gupta1.3K views
Talk from NVidia Developer Connect by Anuj Gupta
Talk from NVidia Developer ConnectTalk from NVidia Developer Connect
Talk from NVidia Developer Connect
Anuj Gupta497 views
Using Text Embeddings for Information Retrieval by Bhaskar Mitra
Using Text Embeddings for Information RetrievalUsing Text Embeddings for Information Retrieval
Using Text Embeddings for Information Retrieval
Bhaskar Mitra10K views
Convolutional neural networks for sentiment classification by Yunchao He
Convolutional neural networks for sentiment classificationConvolutional neural networks for sentiment classification
Convolutional neural networks for sentiment classification
Yunchao He1.2K views
BIng NLP Expert - Dl summer-school-2017.-jianfeng-gao.v2 by Karthik Murugesan
BIng NLP Expert - Dl summer-school-2017.-jianfeng-gao.v2BIng NLP Expert - Dl summer-school-2017.-jianfeng-gao.v2
BIng NLP Expert - Dl summer-school-2017.-jianfeng-gao.v2
Karthik Murugesan522 views
Information Retrieval with Deep Learning by Adam Gibson
Information Retrieval with Deep LearningInformation Retrieval with Deep Learning
Information Retrieval with Deep Learning
Adam Gibson7.2K views

Viewers also liked

Python Visualisation for Data Science by
Python Visualisation for Data SciencePython Visualisation for Data Science
Python Visualisation for Data ScienceAmit Kapoor
2.3K views17 slides
Visualising Multi Dimensional Data by
Visualising Multi Dimensional DataVisualising Multi Dimensional Data
Visualising Multi Dimensional DataAmit Kapoor
14K views86 slides
Model Visualisation by
Model VisualisationModel Visualisation
Model VisualisationAmit Kapoor
1.6K views60 slides
Learning the Craft of Data Visualisation by
Learning the Craft of Data VisualisationLearning the Craft of Data Visualisation
Learning the Craft of Data VisualisationAmit Kapoor
1.7K views58 slides
Drawing word2vec by
Drawing word2vecDrawing word2vec
Drawing word2vecKai Sasaki
11.5K views18 slides
Tools & Resources for Data Visualisation by
Tools & Resources for Data VisualisationTools & Resources for Data Visualisation
Tools & Resources for Data VisualisationAmit Kapoor
4.5K views34 slides

Viewers also liked(20)

Python Visualisation for Data Science by Amit Kapoor
Python Visualisation for Data SciencePython Visualisation for Data Science
Python Visualisation for Data Science
Amit Kapoor2.3K views
Visualising Multi Dimensional Data by Amit Kapoor
Visualising Multi Dimensional DataVisualising Multi Dimensional Data
Visualising Multi Dimensional Data
Amit Kapoor14K views
Model Visualisation by Amit Kapoor
Model VisualisationModel Visualisation
Model Visualisation
Amit Kapoor1.6K views
Learning the Craft of Data Visualisation by Amit Kapoor
Learning the Craft of Data VisualisationLearning the Craft of Data Visualisation
Learning the Craft of Data Visualisation
Amit Kapoor1.7K views
Drawing word2vec by Kai Sasaki
Drawing word2vecDrawing word2vec
Drawing word2vec
Kai Sasaki11.5K views
Tools & Resources for Data Visualisation by Amit Kapoor
Tools & Resources for Data VisualisationTools & Resources for Data Visualisation
Tools & Resources for Data Visualisation
Amit Kapoor4.5K views
Word2vec algorithm by Andrew Koo
Word2vec algorithmWord2vec algorithm
Word2vec algorithm
Andrew Koo12.3K views
Data Storytelling: The only way to unlock true insight from your data by Bright North
Data Storytelling: The only way to unlock true insight from your dataData Storytelling: The only way to unlock true insight from your data
Data Storytelling: The only way to unlock true insight from your data
Bright North3.5K views
Storytelling with Data - Approach | Skills by Amit Kapoor
Storytelling with Data - Approach | SkillsStorytelling with Data - Approach | Skills
Storytelling with Data - Approach | Skills
Amit Kapoor3.5K views
Data stories - how to combine the power storytelling with effective data visu... by Coincidencity
Data stories - how to combine the power storytelling with effective data visu...Data stories - how to combine the power storytelling with effective data visu...
Data stories - how to combine the power storytelling with effective data visu...
Coincidencity27.8K views
The 8 Hats of Data Visualisation by Andy Kirk
The 8 Hats of Data VisualisationThe 8 Hats of Data Visualisation
The 8 Hats of Data Visualisation
Andy Kirk81.8K views
Veda Semantics - introduction document by rajatkr
Veda Semantics - introduction documentVeda Semantics - introduction document
Veda Semantics - introduction document
rajatkr641 views
Yarlin pilataxi practica hoja de calculo by yarlin04
Yarlin pilataxi practica hoja de calculoYarlin pilataxi practica hoja de calculo
Yarlin pilataxi practica hoja de calculo
yarlin0466 views
【來崇明學聰明】藝文老師怎麼教 by Yu Ru Huang
 【來崇明學聰明】藝文老師怎麼教 【來崇明學聰明】藝文老師怎麼教
【來崇明學聰明】藝文老師怎麼教
Yu Ru Huang305 views
Deep Learning in Natural Language Processing by David Dao
Deep Learning in Natural Language ProcessingDeep Learning in Natural Language Processing
Deep Learning in Natural Language Processing
David Dao1.2K views
W jaki sposób myślimy o świecie społecznym by Paula Pilarska
W jaki sposób myślimy o świecie społecznymW jaki sposób myślimy o świecie społecznym
W jaki sposób myślimy o świecie społecznym
Paula Pilarska1.9K views

Similar to Deep Learning for NLP

Text classification in scikit-learn by
Text classification in scikit-learnText classification in scikit-learn
Text classification in scikit-learnJimmy Lai
14.8K views24 slides
Representation Learning of Text for NLP by
Representation Learning of Text for NLPRepresentation Learning of Text for NLP
Representation Learning of Text for NLPAnuj Gupta
5.4K views267 slides
Get Your Hands Dirty with Intel® Distribution for Python* by
Get Your Hands Dirty with Intel® Distribution for Python*Get Your Hands Dirty with Intel® Distribution for Python*
Get Your Hands Dirty with Intel® Distribution for Python*Intel® Software
1.5K views28 slides
Introduction to Text Mining by
Introduction to Text MiningIntroduction to Text Mining
Introduction to Text MiningMinha Hwang
16.7K views25 slides
Deep learning for NLP by
Deep learning for NLPDeep learning for NLP
Deep learning for NLPShishir Choudhary
375 views22 slides
Big Data Analytics (ML, DL, AI) hands-on by
Big Data Analytics (ML, DL, AI) hands-onBig Data Analytics (ML, DL, AI) hands-on
Big Data Analytics (ML, DL, AI) hands-onDony Riyanto
1.1K views58 slides

Similar to Deep Learning for NLP(20)

Text classification in scikit-learn by Jimmy Lai
Text classification in scikit-learnText classification in scikit-learn
Text classification in scikit-learn
Jimmy Lai14.8K views
Representation Learning of Text for NLP by Anuj Gupta
Representation Learning of Text for NLPRepresentation Learning of Text for NLP
Representation Learning of Text for NLP
Anuj Gupta5.4K views
Get Your Hands Dirty with Intel® Distribution for Python* by Intel® Software
Get Your Hands Dirty with Intel® Distribution for Python*Get Your Hands Dirty with Intel® Distribution for Python*
Get Your Hands Dirty with Intel® Distribution for Python*
Intel® Software1.5K views
Introduction to Text Mining by Minha Hwang
Introduction to Text MiningIntroduction to Text Mining
Introduction to Text Mining
Minha Hwang16.7K views
Big Data Analytics (ML, DL, AI) hands-on by Dony Riyanto
Big Data Analytics (ML, DL, AI) hands-onBig Data Analytics (ML, DL, AI) hands-on
Big Data Analytics (ML, DL, AI) hands-on
Dony Riyanto1.1K views
CS3114_09212011.ppt by Arumugam90
CS3114_09212011.pptCS3114_09212011.ppt
CS3114_09212011.ppt
Arumugam9013 views
Dataiku hadoop summit - semi-supervised learning with hadoop for understand... by Dataiku
Dataiku   hadoop summit - semi-supervised learning with hadoop for understand...Dataiku   hadoop summit - semi-supervised learning with hadoop for understand...
Dataiku hadoop summit - semi-supervised learning with hadoop for understand...
Dataiku5.8K views
Exploring Correlation Between Sentiment of Environmental Tweets and the Stock... by Data Works MD
Exploring Correlation Between Sentiment of Environmental Tweets and the Stock...Exploring Correlation Between Sentiment of Environmental Tweets and the Stock...
Exploring Correlation Between Sentiment of Environmental Tweets and the Stock...
Data Works MD158 views
Data Science Accelerator Program by GoDataDriven
Data Science Accelerator ProgramData Science Accelerator Program
Data Science Accelerator Program
GoDataDriven581 views
Dice.com Bay Area Search - Beyond Learning to Rank Talk by Simon Hughes
Dice.com Bay Area Search - Beyond Learning to Rank TalkDice.com Bay Area Search - Beyond Learning to Rank Talk
Dice.com Bay Area Search - Beyond Learning to Rank Talk
Simon Hughes945 views
RDataMining slides-text-mining-with-r by Yanchang Zhao
RDataMining slides-text-mining-with-rRDataMining slides-text-mining-with-r
RDataMining slides-text-mining-with-r
Yanchang Zhao782 views
Section1 compound data class by Dương Tùng
Section1 compound data classSection1 compound data class
Section1 compound data class
Dương Tùng599 views
Cassandra Summit 2014: Social Media Security Company Nexgate Relies on Cassan... by DataStax Academy
Cassandra Summit 2014: Social Media Security Company Nexgate Relies on Cassan...Cassandra Summit 2014: Social Media Security Company Nexgate Relies on Cassan...
Cassandra Summit 2014: Social Media Security Company Nexgate Relies on Cassan...
DataStax Academy1.8K views
Into the Wild - wilth Natural Language Processing and Text Classification - D... by Peter Grosskopf
Into the Wild - wilth Natural Language Processing and Text Classification - D...Into the Wild - wilth Natural Language Processing and Text Classification - D...
Into the Wild - wilth Natural Language Processing and Text Classification - D...
Peter Grosskopf577 views
""Into the Wild" ... with Natural Language Processing and Text Classification... by Dataconomy Media
""Into the Wild" ... with Natural Language Processing and Text Classification...""Into the Wild" ... with Natural Language Processing and Text Classification...
""Into the Wild" ... with Natural Language Processing and Text Classification...
Dataconomy Media368 views

More from Amit Kapoor

The Power of Ensembles in Machine Learning by
The Power of Ensembles in Machine LearningThe Power of Ensembles in Machine Learning
The Power of Ensembles in Machine LearningAmit Kapoor
1.2K views51 slides
Visualising Big Data by
Visualising Big DataVisualising Big Data
Visualising Big DataAmit Kapoor
8.7K views21 slides
Fifth Elephant 2014 talk - Crafting Visual Stories with Data by
Fifth Elephant 2014 talk - Crafting Visual Stories with DataFifth Elephant 2014 talk - Crafting Visual Stories with Data
Fifth Elephant 2014 talk - Crafting Visual Stories with DataAmit Kapoor
9.8K views76 slides
Storytelling with Data - See | Show | Tell | Engage by
Storytelling with Data - See | Show | Tell | EngageStorytelling with Data - See | Show | Tell | Engage
Storytelling with Data - See | Show | Tell | EngageAmit Kapoor
7.5K views145 slides
Crafting Visual Stories with Data by
Crafting Visual Stories with DataCrafting Visual Stories with Data
Crafting Visual Stories with DataAmit Kapoor
26.2K views89 slides
Business Process Improvement - A Strategic and Supply Chain Perspective by
Business Process Improvement - A Strategic and Supply Chain Perspective Business Process Improvement - A Strategic and Supply Chain Perspective
Business Process Improvement - A Strategic and Supply Chain Perspective Amit Kapoor
1.8K views25 slides

More from Amit Kapoor(14)

The Power of Ensembles in Machine Learning by Amit Kapoor
The Power of Ensembles in Machine LearningThe Power of Ensembles in Machine Learning
The Power of Ensembles in Machine Learning
Amit Kapoor1.2K views
Visualising Big Data by Amit Kapoor
Visualising Big DataVisualising Big Data
Visualising Big Data
Amit Kapoor8.7K views
Fifth Elephant 2014 talk - Crafting Visual Stories with Data by Amit Kapoor
Fifth Elephant 2014 talk - Crafting Visual Stories with DataFifth Elephant 2014 talk - Crafting Visual Stories with Data
Fifth Elephant 2014 talk - Crafting Visual Stories with Data
Amit Kapoor9.8K views
Storytelling with Data - See | Show | Tell | Engage by Amit Kapoor
Storytelling with Data - See | Show | Tell | EngageStorytelling with Data - See | Show | Tell | Engage
Storytelling with Data - See | Show | Tell | Engage
Amit Kapoor7.5K views
Crafting Visual Stories with Data by Amit Kapoor
Crafting Visual Stories with DataCrafting Visual Stories with Data
Crafting Visual Stories with Data
Amit Kapoor26.2K views
Business Process Improvement - A Strategic and Supply Chain Perspective by Amit Kapoor
Business Process Improvement - A Strategic and Supply Chain Perspective Business Process Improvement - A Strategic and Supply Chain Perspective
Business Process Improvement - A Strategic and Supply Chain Perspective
Amit Kapoor1.8K views
What makes a data-story work? by Amit Kapoor
What makes a data-story work?What makes a data-story work?
What makes a data-story work?
Amit Kapoor2.1K views
What is Strategy - Thinking like a Strategist by Amit Kapoor
What is Strategy - Thinking like a StrategistWhat is Strategy - Thinking like a Strategist
What is Strategy - Thinking like a Strategist
Amit Kapoor4.7K views
Telling Stories with Data - Using Story Spine by Amit Kapoor
Telling Stories with Data - Using Story SpineTelling Stories with Data - Using Story Spine
Telling Stories with Data - Using Story Spine
Amit Kapoor4.8K views
Story Structure and Modern Storytelling by Amit Kapoor
Story Structure and Modern StorytellingStory Structure and Modern Storytelling
Story Structure and Modern Storytelling
Amit Kapoor2K views
Targeting the Moment of Truth - Using Big Data in Retail by Amit Kapoor
Targeting the Moment of Truth - Using Big Data in RetailTargeting the Moment of Truth - Using Big Data in Retail
Targeting the Moment of Truth - Using Big Data in Retail
Amit Kapoor1.3K views
Storytelling - Gutenberg by Amit Kapoor
Storytelling - GutenbergStorytelling - Gutenberg
Storytelling - Gutenberg
Amit Kapoor534 views
Analytics in Consulting by Amit Kapoor
Analytics in ConsultingAnalytics in Consulting
Analytics in Consulting
Amit Kapoor2.7K views
Retail Pricing Perspective by Amit Kapoor
Retail Pricing PerspectiveRetail Pricing Perspective
Retail Pricing Perspective
Amit Kapoor2.2K views

Recently uploaded

[DSC Europe 23][DigiHealth] Muthu Ramachandran AI and Blockchain Framework fo... by
[DSC Europe 23][DigiHealth] Muthu Ramachandran AI and Blockchain Framework fo...[DSC Europe 23][DigiHealth] Muthu Ramachandran AI and Blockchain Framework fo...
[DSC Europe 23][DigiHealth] Muthu Ramachandran AI and Blockchain Framework fo...DataScienceConferenc1
6 views77 slides
[DSC Europe 23] Stefan Mrsic_Goran Savic - Evolving Technology Excellence.pptx by
[DSC Europe 23] Stefan Mrsic_Goran Savic - Evolving Technology Excellence.pptx[DSC Europe 23] Stefan Mrsic_Goran Savic - Evolving Technology Excellence.pptx
[DSC Europe 23] Stefan Mrsic_Goran Savic - Evolving Technology Excellence.pptxDataScienceConferenc1
6 views16 slides
Amy slides.pdf by
Amy slides.pdfAmy slides.pdf
Amy slides.pdfStatsCommunications
5 views13 slides
OECD-Persol Holdings Workshop on Advancing Employee Well-being in Business an... by
OECD-Persol Holdings Workshop on Advancing Employee Well-being in Business an...OECD-Persol Holdings Workshop on Advancing Employee Well-being in Business an...
OECD-Persol Holdings Workshop on Advancing Employee Well-being in Business an...StatsCommunications
5 views26 slides
[DSC Europe 23] Milos Grubjesic Empowering Business with Pepsico s Advanced M... by
[DSC Europe 23] Milos Grubjesic Empowering Business with Pepsico s Advanced M...[DSC Europe 23] Milos Grubjesic Empowering Business with Pepsico s Advanced M...
[DSC Europe 23] Milos Grubjesic Empowering Business with Pepsico s Advanced M...DataScienceConferenc1
7 views11 slides
[DSC Europe 23][Cryptica] Martin_Summer_Digital_central_bank_money_Ideas_init... by
[DSC Europe 23][Cryptica] Martin_Summer_Digital_central_bank_money_Ideas_init...[DSC Europe 23][Cryptica] Martin_Summer_Digital_central_bank_money_Ideas_init...
[DSC Europe 23][Cryptica] Martin_Summer_Digital_central_bank_money_Ideas_init...DataScienceConferenc1
5 views18 slides

Recently uploaded(20)

[DSC Europe 23][DigiHealth] Muthu Ramachandran AI and Blockchain Framework fo... by DataScienceConferenc1
[DSC Europe 23][DigiHealth] Muthu Ramachandran AI and Blockchain Framework fo...[DSC Europe 23][DigiHealth] Muthu Ramachandran AI and Blockchain Framework fo...
[DSC Europe 23][DigiHealth] Muthu Ramachandran AI and Blockchain Framework fo...
[DSC Europe 23] Stefan Mrsic_Goran Savic - Evolving Technology Excellence.pptx by DataScienceConferenc1
[DSC Europe 23] Stefan Mrsic_Goran Savic - Evolving Technology Excellence.pptx[DSC Europe 23] Stefan Mrsic_Goran Savic - Evolving Technology Excellence.pptx
[DSC Europe 23] Stefan Mrsic_Goran Savic - Evolving Technology Excellence.pptx
OECD-Persol Holdings Workshop on Advancing Employee Well-being in Business an... by StatsCommunications
OECD-Persol Holdings Workshop on Advancing Employee Well-being in Business an...OECD-Persol Holdings Workshop on Advancing Employee Well-being in Business an...
OECD-Persol Holdings Workshop on Advancing Employee Well-being in Business an...
[DSC Europe 23] Milos Grubjesic Empowering Business with Pepsico s Advanced M... by DataScienceConferenc1
[DSC Europe 23] Milos Grubjesic Empowering Business with Pepsico s Advanced M...[DSC Europe 23] Milos Grubjesic Empowering Business with Pepsico s Advanced M...
[DSC Europe 23] Milos Grubjesic Empowering Business with Pepsico s Advanced M...
[DSC Europe 23][Cryptica] Martin_Summer_Digital_central_bank_money_Ideas_init... by DataScienceConferenc1
[DSC Europe 23][Cryptica] Martin_Summer_Digital_central_bank_money_Ideas_init...[DSC Europe 23][Cryptica] Martin_Summer_Digital_central_bank_money_Ideas_init...
[DSC Europe 23][Cryptica] Martin_Summer_Digital_central_bank_money_Ideas_init...
LIVE OAK MEMORIAL PARK.pptx by ms2332always
LIVE OAK MEMORIAL PARK.pptxLIVE OAK MEMORIAL PARK.pptx
LIVE OAK MEMORIAL PARK.pptx
ms2332always7 views
Advanced_Recommendation_Systems_Presentation.pptx by neeharikasingh29
Advanced_Recommendation_Systems_Presentation.pptxAdvanced_Recommendation_Systems_Presentation.pptx
Advanced_Recommendation_Systems_Presentation.pptx
3196 The Case of The East River by ErickANDRADE90
3196 The Case of The East River3196 The Case of The East River
3196 The Case of The East River
ErickANDRADE9017 views
[DSC Europe 23] Predrag Ilic & Simeon Rilling - From Data Lakes to Data Mesh ... by DataScienceConferenc1
[DSC Europe 23] Predrag Ilic & Simeon Rilling - From Data Lakes to Data Mesh ...[DSC Europe 23] Predrag Ilic & Simeon Rilling - From Data Lakes to Data Mesh ...
[DSC Europe 23] Predrag Ilic & Simeon Rilling - From Data Lakes to Data Mesh ...
[DSC Europe 23] Danijela Horak - The Innovator’s Dilemma: to Build or Not to ... by DataScienceConferenc1
[DSC Europe 23] Danijela Horak - The Innovator’s Dilemma: to Build or Not to ...[DSC Europe 23] Danijela Horak - The Innovator’s Dilemma: to Build or Not to ...
[DSC Europe 23] Danijela Horak - The Innovator’s Dilemma: to Build or Not to ...
[DSC Europe 23] Ales Gros - Quantum and Today s security with Quantum.pdf by DataScienceConferenc1
[DSC Europe 23] Ales Gros - Quantum and Today s security with Quantum.pdf[DSC Europe 23] Ales Gros - Quantum and Today s security with Quantum.pdf
[DSC Europe 23] Ales Gros - Quantum and Today s security with Quantum.pdf
CRM stick or twist workshop by info828217
CRM stick or twist workshopCRM stick or twist workshop
CRM stick or twist workshop
info82821711 views
SUPER STORE SQL PROJECT.pptx by khan888620
SUPER STORE SQL PROJECT.pptxSUPER STORE SQL PROJECT.pptx
SUPER STORE SQL PROJECT.pptx
khan88862013 views
CRM stick or twist.pptx by info828217
CRM stick or twist.pptxCRM stick or twist.pptx
CRM stick or twist.pptx
info82821711 views
[DSC Europe 23] Spela Poklukar & Tea Brasanac - Retrieval Augmented Generation by DataScienceConferenc1
[DSC Europe 23] Spela Poklukar & Tea Brasanac - Retrieval Augmented Generation[DSC Europe 23] Spela Poklukar & Tea Brasanac - Retrieval Augmented Generation
[DSC Europe 23] Spela Poklukar & Tea Brasanac - Retrieval Augmented Generation

Deep Learning for NLP

  • 1. Deep Learning for Natural Language Processing        Bargava Subramanian @bargava Amit Kapoor @amitkaps 1
  • 3. Put these adjectives in order: [adj.] + [Knife] — old — French — lovely — green — rectangular — whittling — silver — little 3
  • 4. Which order is correct? lovely old silver rectangular green little French whittling knife old lovely French rectangular green little whittling silver knife lovely little old rectangular green French silver whittling knife 4
  • 5. Grammar has rules opinion - size - age - shape - colour - origin -material - purpose [Noun] The right version: lovely little old rectangular green French silver whittling knife 5
  • 6. We speak the grammar, yet we don't know it 6
  • 8. Natural Language Programming Problems — Summarization — Text Classification (e.g. spam) — Sentiment / Emotion Analysis — Topic Modelling — Recommendations — Text Evaluation (e.g. grading) 8
  • 9. Plan for this Session — Moving beyond Statistical Learning — Take first steps in NLP with Deep Learning — Showcase an example — Practical challenges to overcome 9
  • 10. NLP Learning Process ___ [1] Frame: Problem definition [2] Acquire: Text ingestion [3] Refine: Text wrangling [4] Transform: Feature creation [5] Explore: Feature selection [6] Model: Model selection [7] Insight: Solution communication 10
  • 12. Demonetisation in India On Nov 8th, 2016, the National Government announced that existing INR 1000 and INR 500 notes are no longer legal. 12
  • 13. 13
  • 14. Reactions on Twitter People started tweeting with the tag: #demonetisation 14
  • 15. [1] Frame Create a viral tweet on #demonetisation 15
  • 16. Traditional way of framing 1. Someone has to write a tweet. 2. Run it on the classifier 3. If probability is high, post it. 4. Else, goto step 1 The prediction will be a probability of a new tweet to go viral or not? 16
  • 17. Generating tweets — Can we learn from historical tweets algorithmically to generate a viral tweet? — Not possible to do using traditional methods 17
  • 18. Revised framing for Text Generation Generate a tweet algorithmically, that is likely to go viral 18
  • 19. [2] Acquire Get the raw tweets data 19
  • 20. Get Tweets on #demonetisation Write your own twitter api client to get json file or use a python package like Tweepy, but need to manage rate limiting etc. We used tweezer - an open source project to get twitter data Raw dataset - 30,000+ tweets from past 1 week. 20
  • 21. [3] Refine How to categorise a tweet as viral or not? 21
  • 22. Simple Approach for Labelling IF retweets + favourites > = 100 THEN Label = viral ELSE Label = normal 22
  • 23. Sanitizing Tweets — Stopword — Stemming — Remove urls — Remove 'RT' — Remove 'n' 23
  • 25. Traditional methods to covert text to numeric — TF-IDF: Measures importance of a word in a document relative to the corpus — Bag-of-Word: Count of occurrences of a word in a document — n-grams: Count of every 1-word, 2-word, etc combinations in a document — entity & POS tagging: Transform sentence to parts-of-speech, extract entities and encode 25
  • 26. Challenges in traditional methods of encoding — Sparse inputs — Input data space explodes — Context lost in encoding A quiet crowd entered the historic church != A historic crowd entered the quiet church 26
  • 27. Deep Learning Approach Low-dimensional dense vectors for representation. — Tokenise characters (Faster) — Tokenise words (More accurate, but needs more memory) 27
  • 28. Word Embedding — Learn high-quality word vectors — Similar words needs to be close to each other — Words can have multiple degrees of similarity 28
  • 29. Word Embedding using word2vec Combines two approaches — skip-gram: Predicting word given its context — continuous bag-of-words: Predicting context given a word 29
  • 30. word2vec: Example vec[queen] − vec[king] = vec[woman] − vec[man] 1 1 https://www.tensorflow.org/versions/r0.12/tutorials/word2vec/index.html 30
  • 32. Feature Selection — Manual process in Traditional Approach — Feature selection happens automatically in Deep Learning 32
  • 34. Recurrent Neural Network (RNN) — Network with loops — Allows information to persist — Enables connecting previous information to present task — Context preserved I grew up in Brazil and I speak ______________.                                                         portuguese 34
  • 35. Unrolling over Time ____ [1] Think sequences - in input & output      - Recognize Image -> Explain in words - Sentence(s) -> Sentiment Analysis - English - Spanish Translation - Video - task classification 35
  • 36. Unrolled RNN [2] Multiple copies of the same network [3] Each pass message to its successor 2 2 http://colah.github.io/posts/2015-08-Understanding-LSTMs/ 36
  • 40. Deep Learning Challenges — Data Size: RNN doesn't generalize well on small datasets — Relevant Corpus: Required to create domain specific word embedding — Deeper Networks: Empirically deeper networks have better accuracy — Training Time: RNNs take a long time to learn. 40
  • 41. Use case: Chat Bots — Bookings — Customer Support — Help Desk Automation — ... 41
  • 42. Tools to get started: Software Python Stack - Use spacy for NLP preprocessing - Use gensim for word2vec training - Start with keras - Have tensorflow as backend Use pre-trained models like word2vec for word embedding and similarly for RNNs 42
  • 43. Tools to get started: Hardware Work on GPUs - Nvidia TitanX (suitable for consumers) - Tesla K80 (suitable for professionals) For detailed hardware choices: http://timdettmers.com/2015/03/09/deep- learning-hardware-guide/ 43
  • 45. Reference: Deep Learning for NLP Notebooks and Material @ https://github.com/rouseguy/ DeepLearningNLP_Py - What is deep learning? - Motivation: Some use cases - Building blocks of Neural Networks (Neuron, Activation Function) - Backpropagation Algorithm - Word Embedding - word2vec - Introduction to keras - Multi-layer perceptron - Convolutional Neural Network - Recurrent Neural Network - Challenges in Deep Learning 45