SlideShare a Scribd company logo
1 of 16
Download to read offline
Tweet like Trump
An exploration of deep learning and natural
language processing into the mind of D. Trump
Presentation by Ed Chin
November 11, 2016
What did I do with
!  26,204 tweets from Donald Trump from 2009-2016
!  10 campaign speeches in 2016
!  And many sleepless hours agonizing over the
results of the presidential election
!  I built a character-based text generation model
using a recurrent neural network (LSTMs variant)
to simulate Trump’s tweets
Why Donald Trump?
!  Because he is a polarized figure who trolls the
twitter-verse like nobody’s business
!  Because he exuded so much negative sentiment
in his daily rhetoric it would be a complete waste
of time performing a sentiment analysis on him
!  Because you are going to hear from him for at
least four more years…might as well get used to it
Ok, let’s get the boring
technical stuff out of the way
!  Going Deep…
Why Recurrent Neural Network?
!  RNN takes as their input not just the current input
it sees, but also one step back in time
!  It combines the present and the recent past to
respond to new data, much as we do in life
!  With its ability to have “memory”, RNN
dramatically improves performance over CNN
(Word2Vec) or Markov Chain Generator
What is Long Short Term
Memory Units (LSTMs)?
!  LSTMs is a variation of RNN that is surprising
effective in combating the vanishing gradient
problem
!  LSTM helps preserves the error that can be back-
propagated through time and layers
!  Text contains recurrent themes at varying
intervals, something that LSTMs are good at
capturing
How did I train the model?
!  Single character classification problem with 52
classes (unique characters) and as such is
defined as optimizing log loss, as opposed to
classification accuracy
!  2,237,658 characters in corpus
!  Two layers LSTM with 256 hidden nodes in first
layer and 512 nodes in the second layer, with 0.2
dropout after each layer (~1.9mm parameters)
!  Model was optimized after ~35 epochs at 1.0306
loss rate over a 2 day period
Techniques and Tools
Now comes the fun stuff…
Boom-shaka-laka
! App is live - http://52.55.95.182:8080
Step 1:
Which Trump do you want?
!  Increasing temperature, aka “Idiocy Factor”, will
give more diversity but at cost of more mistakes
Step 2:
Choose a Topic
!  The key words were chosen based on a topic
modeling exercise using LDA
Step 3:
Click “Trumpify” to get live tweets
!  Adjust the sentence length using the slider
!  Wait ~5 seconds for the model to generate results
Sample Outputs from Model
!  Republicans must stop relying on losers like
@karlrove and jeb bush and what do it was a total
disaster. not going to be a ticket of the polls. I
mean, I mean, we’ll have a country. I dont know
!  Is @realdonaldtrump debating crooked
@hillaryclinton said they want a great thing in the
world trade deals. I got the money and they have
to do it. So were going to be able to do well with
the world. I was a tremendous deal with mexico
and they dont want to do that. I dont know what
!  Jon stewart is a joke, not very bright and totally
overrated in charlotte of the world to call for a
record the real work not to see each other for a
support. The republicans have scandal country that
i had a long time i was a no time for the history of
the president obama is a total disaster
Reflecting on Model Results
!  Very impressive considering the model had to
learn English completely from scratch and know
where to put commas and spaces
!  The trained LSTM model shows glimmer of insights
!  It frequently supports its own argument
!  It rambles just like Trump
!  Model does a good job walking the fine line
between memorization and creativity
Future Work
!  Remove punctuations from source text, and
therefore reduce model’s vocabulary for training
!  Train model on padded sentence rather than
random sequences of work
!  Add more layers and neurons and tune the
dropout percentage.
!  Train over 100 epochs
!  Apply regularization to combat overfitting
Contact Info
!  Ed Chin
!  Email: echin6@gmail.com
!  Linkedin:
!  https://www.linkedin.com/in/edwin-chin-62392b1
!  Blog: echin6.github.io
!  Repo: echin6/metis_projects

More Related Content

Similar to Deep Learning Trump Tweets

Module 8: Natural language processing Pt 1
Module 8:  Natural language processing Pt 1Module 8:  Natural language processing Pt 1
Module 8: Natural language processing Pt 1Sara Hooker
 
Modern communication
Modern communicationModern communication
Modern communicationIrina K
 
Handling and Mining Linguistic Variation in UGC
Handling and Mining Linguistic Variation in UGCHandling and Mining Linguistic Variation in UGC
Handling and Mining Linguistic Variation in UGCLeon Derczynski
 
Data sience coffe
Data sience coffeData sience coffe
Data sience coffeNoboru Kano
 
Internet words into our language
Internet words into our languageInternet words into our language
Internet words into our languageRodneyFox
 
Language online, from memes to semaphore
Language online, from memes to semaphoreLanguage online, from memes to semaphore
Language online, from memes to semaphoreAnton Hecht
 
THE MECHANICS AND APPLICATIONS OF LARGE LANGUAGE MODELS.pptx
THE MECHANICS AND APPLICATIONS OF LARGE LANGUAGE MODELS.pptxTHE MECHANICS AND APPLICATIONS OF LARGE LANGUAGE MODELS.pptx
THE MECHANICS AND APPLICATIONS OF LARGE LANGUAGE MODELS.pptxUditJain51042
 
Chatbots in 2017 -- Ithaca Talk Dec 6
Chatbots in 2017 -- Ithaca Talk Dec 6Chatbots in 2017 -- Ithaca Talk Dec 6
Chatbots in 2017 -- Ithaca Talk Dec 6Paul Houle
 
Communication and Information Technology
Communication and Information TechnologyCommunication and Information Technology
Communication and Information TechnologyCrystal Kelley
 
Argumentative Essay On Teenage Pregnancy
Argumentative Essay On Teenage PregnancyArgumentative Essay On Teenage Pregnancy
Argumentative Essay On Teenage PregnancyPatty Loen
 
Irish Essay Home Alone. Online assignment writing service.
Irish Essay Home Alone. Online assignment writing service.Irish Essay Home Alone. Online assignment writing service.
Irish Essay Home Alone. Online assignment writing service.Kimi Allen
 
TechnoStress: Like Being Foreigner
TechnoStress:  Like Being ForeignerTechnoStress:  Like Being Foreigner
TechnoStress: Like Being ForeignerBeth Kanter
 
Digital Design Fiction: Transmedia & Foresight
Digital Design Fiction: Transmedia & ForesightDigital Design Fiction: Transmedia & Foresight
Digital Design Fiction: Transmedia & ForesightWorldFuture2015
 
Psychology for designers or 3 predictions from psychology for the future of ...
Psychology for designers or 3 predictions from psychology  for the future of ...Psychology for designers or 3 predictions from psychology  for the future of ...
Psychology for designers or 3 predictions from psychology for the future of ...cxpartners
 
Psychology for designers or 3 predictions from psychology for the future of ...
Psychology for designers or 3 predictions from psychology  for the future of ...Psychology for designers or 3 predictions from psychology  for the future of ...
Psychology for designers or 3 predictions from psychology for the future of ...Joe Leech
 
2007 amazon as hub of world brain final-6.51
2007 amazon as hub of world brain final-6.512007 amazon as hub of world brain final-6.51
2007 amazon as hub of world brain final-6.51Robert David Steele Vivas
 
Language and the internet final
Language and the internet finalLanguage and the internet final
Language and the internet finalCherie Dargan
 
Machine Learning for Non-technical People
Machine Learning for Non-technical PeopleMachine Learning for Non-technical People
Machine Learning for Non-technical Peopleindico data
 

Similar to Deep Learning Trump Tweets (20)

Module 8: Natural language processing Pt 1
Module 8:  Natural language processing Pt 1Module 8:  Natural language processing Pt 1
Module 8: Natural language processing Pt 1
 
Modern communication
Modern communicationModern communication
Modern communication
 
Handling and Mining Linguistic Variation in UGC
Handling and Mining Linguistic Variation in UGCHandling and Mining Linguistic Variation in UGC
Handling and Mining Linguistic Variation in UGC
 
Data sience coffe
Data sience coffeData sience coffe
Data sience coffe
 
Internet words into our language
Internet words into our languageInternet words into our language
Internet words into our language
 
Language online, from memes to semaphore
Language online, from memes to semaphoreLanguage online, from memes to semaphore
Language online, from memes to semaphore
 
THE MECHANICS AND APPLICATIONS OF LARGE LANGUAGE MODELS.pptx
THE MECHANICS AND APPLICATIONS OF LARGE LANGUAGE MODELS.pptxTHE MECHANICS AND APPLICATIONS OF LARGE LANGUAGE MODELS.pptx
THE MECHANICS AND APPLICATIONS OF LARGE LANGUAGE MODELS.pptx
 
Chatbots in 2017 -- Ithaca Talk Dec 6
Chatbots in 2017 -- Ithaca Talk Dec 6Chatbots in 2017 -- Ithaca Talk Dec 6
Chatbots in 2017 -- Ithaca Talk Dec 6
 
Communication and Information Technology
Communication and Information TechnologyCommunication and Information Technology
Communication and Information Technology
 
My bonsai is texting me!
My bonsai is texting me!My bonsai is texting me!
My bonsai is texting me!
 
Argumentative Essay On Teenage Pregnancy
Argumentative Essay On Teenage PregnancyArgumentative Essay On Teenage Pregnancy
Argumentative Essay On Teenage Pregnancy
 
Irish Essay Home Alone. Online assignment writing service.
Irish Essay Home Alone. Online assignment writing service.Irish Essay Home Alone. Online assignment writing service.
Irish Essay Home Alone. Online assignment writing service.
 
TechnoStress: Like Being Foreigner
TechnoStress:  Like Being ForeignerTechnoStress:  Like Being Foreigner
TechnoStress: Like Being Foreigner
 
Digital Design Fiction: Transmedia & Foresight
Digital Design Fiction: Transmedia & ForesightDigital Design Fiction: Transmedia & Foresight
Digital Design Fiction: Transmedia & Foresight
 
Psychology for designers or 3 predictions from psychology for the future of ...
Psychology for designers or 3 predictions from psychology  for the future of ...Psychology for designers or 3 predictions from psychology  for the future of ...
Psychology for designers or 3 predictions from psychology for the future of ...
 
Psychology for designers or 3 predictions from psychology for the future of ...
Psychology for designers or 3 predictions from psychology  for the future of ...Psychology for designers or 3 predictions from psychology  for the future of ...
Psychology for designers or 3 predictions from psychology for the future of ...
 
2007 amazon as hub of world brain final-6.51
2007 amazon as hub of world brain final-6.512007 amazon as hub of world brain final-6.51
2007 amazon as hub of world brain final-6.51
 
Language and the internet final
Language and the internet finalLanguage and the internet final
Language and the internet final
 
12 Hacks for Killer Presentation Decks
12 Hacks for Killer Presentation Decks12 Hacks for Killer Presentation Decks
12 Hacks for Killer Presentation Decks
 
Machine Learning for Non-technical People
Machine Learning for Non-technical PeopleMachine Learning for Non-technical People
Machine Learning for Non-technical People
 

Deep Learning Trump Tweets

  • 1. Tweet like Trump An exploration of deep learning and natural language processing into the mind of D. Trump Presentation by Ed Chin November 11, 2016
  • 2. What did I do with !  26,204 tweets from Donald Trump from 2009-2016 !  10 campaign speeches in 2016 !  And many sleepless hours agonizing over the results of the presidential election !  I built a character-based text generation model using a recurrent neural network (LSTMs variant) to simulate Trump’s tweets
  • 3. Why Donald Trump? !  Because he is a polarized figure who trolls the twitter-verse like nobody’s business !  Because he exuded so much negative sentiment in his daily rhetoric it would be a complete waste of time performing a sentiment analysis on him !  Because you are going to hear from him for at least four more years…might as well get used to it
  • 4. Ok, let’s get the boring technical stuff out of the way !  Going Deep…
  • 5. Why Recurrent Neural Network? !  RNN takes as their input not just the current input it sees, but also one step back in time !  It combines the present and the recent past to respond to new data, much as we do in life !  With its ability to have “memory”, RNN dramatically improves performance over CNN (Word2Vec) or Markov Chain Generator
  • 6. What is Long Short Term Memory Units (LSTMs)? !  LSTMs is a variation of RNN that is surprising effective in combating the vanishing gradient problem !  LSTM helps preserves the error that can be back- propagated through time and layers !  Text contains recurrent themes at varying intervals, something that LSTMs are good at capturing
  • 7. How did I train the model? !  Single character classification problem with 52 classes (unique characters) and as such is defined as optimizing log loss, as opposed to classification accuracy !  2,237,658 characters in corpus !  Two layers LSTM with 256 hidden nodes in first layer and 512 nodes in the second layer, with 0.2 dropout after each layer (~1.9mm parameters) !  Model was optimized after ~35 epochs at 1.0306 loss rate over a 2 day period
  • 9. Now comes the fun stuff… Boom-shaka-laka ! App is live - http://52.55.95.182:8080
  • 10. Step 1: Which Trump do you want? !  Increasing temperature, aka “Idiocy Factor”, will give more diversity but at cost of more mistakes
  • 11. Step 2: Choose a Topic !  The key words were chosen based on a topic modeling exercise using LDA
  • 12. Step 3: Click “Trumpify” to get live tweets !  Adjust the sentence length using the slider !  Wait ~5 seconds for the model to generate results
  • 13. Sample Outputs from Model !  Republicans must stop relying on losers like @karlrove and jeb bush and what do it was a total disaster. not going to be a ticket of the polls. I mean, I mean, we’ll have a country. I dont know !  Is @realdonaldtrump debating crooked @hillaryclinton said they want a great thing in the world trade deals. I got the money and they have to do it. So were going to be able to do well with the world. I was a tremendous deal with mexico and they dont want to do that. I dont know what !  Jon stewart is a joke, not very bright and totally overrated in charlotte of the world to call for a record the real work not to see each other for a support. The republicans have scandal country that i had a long time i was a no time for the history of the president obama is a total disaster
  • 14. Reflecting on Model Results !  Very impressive considering the model had to learn English completely from scratch and know where to put commas and spaces !  The trained LSTM model shows glimmer of insights !  It frequently supports its own argument !  It rambles just like Trump !  Model does a good job walking the fine line between memorization and creativity
  • 15. Future Work !  Remove punctuations from source text, and therefore reduce model’s vocabulary for training !  Train model on padded sentence rather than random sequences of work !  Add more layers and neurons and tune the dropout percentage. !  Train over 100 epochs !  Apply regularization to combat overfitting
  • 16. Contact Info !  Ed Chin !  Email: echin6@gmail.com !  Linkedin: !  https://www.linkedin.com/in/edwin-chin-62392b1 !  Blog: echin6.github.io !  Repo: echin6/metis_projects