Tone Analysis - Fresh Machine Learning #3

Siraj Raval · Beginner ·🧬 Deep Learning ·9y ago

Key Takeaways

This video covers tone analysis, a subfield of natural language processing, using techniques such as word embeddings, convolutional neural networks, and long short-term memory networks, and demonstrates how to implement tone analysis using IBM's Watson API.

Full Transcript

how does that make you feel I'm not sure uh-huh it's hard to say yeah well there's an episode of serology coming and I just don't have time for this right now [Music] so hello world it's SJ have you ever had a hard time trying to understand what someone is trying to say to you people are confusing I don't even understand my own emotions half the time much less what someone else's feeling or thinking when we read a piece of text or listen to someone speak our brains are performing tone analysis we're trying to understand the meaning behind the words that is the sentiment And the emotions and the style it's not an easy task at all but this is something machines can do pretty well now it's all a part of a subfield of machine learning called natural language processing standard approaches to NLP a couple years ago involved extracting a set of features from some labeled piece of text the features were usually engrams engrams have nothing to do with graham crackers even though they are extremely delicious engrams are just sequences of words so a unigram is one word Byram is two and trigram is three once the engrams were extracted The Next Step was to train a linear model on some pre-labeled data so they could classify similar text the process of feature extraction saw a huge leap forward when Google open sourced something called word to VC word to V is a toolkit that helps encode words into vectors these vectors are representations of words called word embeddings that are learned by training on a given Corpus the toolkit consists of two distinct models skip gram and continuous bag of work words the skip gram model predicts the neighboring words given the current word in a given window in contrast the bag of words model predicts the current word given the neighboring words in a given window these models both help predict and encode words once we have these vectors we can use them to do all sorts of text classification including tone analysis deep learning one of the first papers to show that deep learning could improve text analysis was called convolutional neural networks for sentence classification although CNN were intended for computer Vision these guys applied it to NLP they first trained the CNN on a set of word vectors that Google extracted from a 100 billion word Corpus using their own word to V toolkit after training the CNN had built representations of all sorts of word categories since the vectors weren't labeled in any way the training was considered unsupervised after they had it trained on a set of Google vectors they then trained it using label data so that it could perform sentiment analysis A later paper called text categorization using lstm for region embeddings improved on it they did the same basic experiment but the key difference is that they didn't just use a CNN to create embeddings they also used a long short-term memory Network an lstm is a type of recurrent neural network that can remember dependencies from way back in the sequence of data and they found that they had the best classification result when they combined the embeddings from both the lstm and the CNN just like twps in a algorithm that was terrible they also found that embedding regions that are sets of War words was more effective than embedding single words this idea of abstractions of a hierarchy of knowledge in a given document helped inspire a fresh paper released just 2 months ago called hierarchical attention networks for document classification these guys said let's create a new neural architecture to model a document it starts by encoding words and applying an attention mechanism to extract the most important words then it encodes the sentences using the weights it learned and applies an attention mechanism to that too to extract the most important sentences it uses those weights to build document level vectors so it's creating vectors for each layer of abstraction within a document and building them off of each other the encoder for each of these levels is called a GRU neural net so after they initialized the model using vectors they got using word to VC they trained it on labeled data and doing this with their novel neural architecture pretty much outperformed all previous attempts can't touch this so how do we implement this stuff ourselves well as Professor Ang says deep learning requires a rocket the model and Rocket Fuel the data but sometimes you just want to get done and training is too time expensive that's why we're going to use IBM's Watson API to perform tone analysis on an example set first we'll need to sign up for their cloud service called Blu miix once we've registered we'll click on Watson then tone analyzer we'll create a new service using the standard plan which lets us try it out for free so no need to enter a credit card which is perfect cuz I'm poor then we'll click on service credentials and record our username and password since we'll need them to authenticate from our web app then we can generate a new node Express web app using npm and the express generator module in our app we'll import our Watson developer Cloud mpm module which acts as a thin JavaScript wrapper around their API we have two routes here both for our index page we'll start with the get route when we make a get request to the index page we want to display some HTML that we can send programmatically here we'll send an input form that asks for some Corpus then in our post route we'll retrieve the input that the user submits via the post request then initialize the tone analyzer variable fill in our credentials then call the tone function using the user input variable as the parameter this will return the analysis of the text as Json which we can view in terminal let's try it out as you can see it raised the Corpus on three levels emotions language style and social Tendencies you'll get back a percentage for each of three language Styles and five social Tendencies it does this at both the document level and sentence level tone analysis is a tool you can use to better your writing and be more clear about the message you're trying to convey dope links for you down below please subscribe for more ml videos I've got to go fix an indentation error so thanks for watching

Original Description

This episode of Fresh Machine Learning is all Tone Analysis. Tone analysis consists of not just analyzing sentiment (positive or negative), but also analyzing emotions as well as writing style. There are a lot of dimensions to tone, and in this episode I talk about what I consider to be 3 seminal papers in this field. At the end of the episode, we use IBM’s Watson Tone Analyzer API to build our own tone analysis web app. The demo code for this video can be found here: https://github.com/llSourcell/Tone-Analyzer I created a Slack channel for us, sign up here: https://wizards.herokuapp.com/ I introduce three papers in this video Convolutional neural networks for sentence classification: http://emnlp2014.org/papers/pdf/EMNLP2014181.pdf Text categorization using LSTM for region embeddings: http://arxiv.org/pdf/1602.02373v2.pdf Hierarchical attention networks for document classification: https://www.cs.cmu.edu/~diyiy/docs/naacl16.pdf More info about the IBM Watson Tone Analyzer API: http://www.ibm.com/watson/developercloud/tone-analyzer.html Some great notes, slides, and practice problems for NLP: http://cs224d.stanford.edu/syllabus.html Live demo of the Watson Tone Analyzer: https://tone-analyzer-demo.mybluemix.net/ Really great long-form page talking about text classification http://www.nltk.org/book/ch06.html I love you guys! Thanks for watching my videos, I do it for you. I left my awesome job at Twilio and I'm doing this full time now. I recently created a Patreon page. If you like my videos, feel free to help support my effort here!: https://www.patreon.com/user?ty=h&u=3191693 Much more to come so please subscribe, like, and comment. Follow me: Twitter: https://twitter.com/sirajraval Facebook: https://www.facebook.com/sirajology Instagram: https://www.instagram.com/sirajraval/ Instagram: https://www.instagram.com/sirajraval/ Signup for my newsletter for exciting updates in the field of AI: https://goo.gl/FZzJ5w Hit the Join button above to si
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Siraj Raval · Siraj Raval · 26 of 60

1 What is Bitcoin?
What is Bitcoin?
Siraj Raval
2 5 Ways to Use Bitcoin
5 Ways to Use Bitcoin
Siraj Raval
3 BTC Fever - Siraj [Music Video]
BTC Fever - Siraj [Music Video]
Siraj Raval
4 5 Reasons to Build Decentralized Apps
5 Reasons to Build Decentralized Apps
Siraj Raval
5 The Interplanetary File System
The Interplanetary File System
Siraj Raval
6 How to Build a Dapp in 3 min
How to Build a Dapp in 3 min
Siraj Raval
7 Life Before Smartphones
Life Before Smartphones
Siraj Raval
8 4 Ways to Use Smart Contracts
4 Ways to Use Smart Contracts
Siraj Raval
9 3 Dapps You HAVE to See
3 Dapps You HAVE to See
Siraj Raval
10 Char's Life as a BitTorrent Engineer
Char's Life as a BitTorrent Engineer
Siraj Raval
11 4 Reasons AlphaGo is a Huge Deal
4 Reasons AlphaGo is a Huge Deal
Siraj Raval
12 Build a Neural Net in 4 Minutes
Build a Neural Net in 4 Minutes
Siraj Raval
13 Sentiment Analysis in 4 Minutes
Sentiment Analysis in 4 Minutes
Siraj Raval
14 The Hackathon Life
The Hackathon Life
Siraj Raval
15 Your First ML App - Machine Learning for Hackers #1
Your First ML App - Machine Learning for Hackers #1
Siraj Raval
16 Build an AI Composer - Machine Learning for Hackers #2
Build an AI Composer - Machine Learning for Hackers #2
Siraj Raval
17 Build a Game AI - Machine Learning for Hackers #3
Build a Game AI - Machine Learning for Hackers #3
Siraj Raval
18 Build a Movie Recommender - Machine Learning for Hackers #4
Build a Movie Recommender - Machine Learning for Hackers #4
Siraj Raval
19 Build an AI Artist - Machine Learning for Hackers #5
Build an AI Artist - Machine Learning for Hackers #5
Siraj Raval
20 Build a Chatbot - ML for Hackers #6
Build a Chatbot - ML for Hackers #6
Siraj Raval
21 Build an AI Reader - Machine Learning for Hackers #7
Build an AI Reader - Machine Learning for Hackers #7
Siraj Raval
22 Build an AI Writer - Machine Learning for Hackers #8
Build an AI Writer - Machine Learning for Hackers #8
Siraj Raval
23 Build a Chatbot w/ an API - ML for Hackers #9
Build a Chatbot w/ an API - ML for Hackers #9
Siraj Raval
24 One-Shot Learning - Fresh Machine Learning #1
One-Shot Learning - Fresh Machine Learning #1
Siraj Raval
25 Generative Adversarial Nets - Fresh Machine Learning #2
Generative Adversarial Nets - Fresh Machine Learning #2
Siraj Raval
Tone Analysis - Fresh Machine Learning #3
Tone Analysis - Fresh Machine Learning #3
Siraj Raval
27 Generate Rap Lyrics - Fresh Machine Learning #4
Generate Rap Lyrics - Fresh Machine Learning #4
Siraj Raval
28 Build an Autoencoder in 5 Min - Fresh Machine Learning #5
Build an Autoencoder in 5 Min - Fresh Machine Learning #5
Siraj Raval
29 Build a Self Driving Car in 5 Min - Fresh Machine Learning #6
Build a Self Driving Car in 5 Min - Fresh Machine Learning #6
Siraj Raval
30 Build an Antivirus in 5 Min - Fresh Machine Learning #7
Build an Antivirus in 5 Min - Fresh Machine Learning #7
Siraj Raval
31 TensorFlow in 5 Minutes (tutorial)
TensorFlow in 5 Minutes (tutorial)
Siraj Raval
32 Build a Recurrent Neural Net in 5 Min
Build a Recurrent Neural Net in 5 Min
Siraj Raval
33 Build a Simulation in 5 Min
Build a Simulation in 5 Min
Siraj Raval
34 Build a TensorFlow Image Classifier in 5 Min
Build a TensorFlow Image Classifier in 5 Min
Siraj Raval
35 Tensorboard Explained in 5 Min
Tensorboard Explained in 5 Min
Siraj Raval
36 Generate Music in TensorFlow
Generate Music in TensorFlow
Siraj Raval
37 Build a Game Bot (LIVE)
Build a Game Bot (LIVE)
Siraj Raval
38 Deep Learning Frameworks Compared
Deep Learning Frameworks Compared
Siraj Raval
39 Introduction - Learn Python for Data Science #1
Introduction - Learn Python for Data Science #1
Siraj Raval
40 Build a Neural Network (LIVE)
Build a Neural Network (LIVE)
Siraj Raval
41 Twitter Sentiment Analysis - Learn Python for Data Science #2
Twitter Sentiment Analysis - Learn Python for Data Science #2
Siraj Raval
42 Recommendation Systems - Learn Python for Data Science #3
Recommendation Systems - Learn Python for Data Science #3
Siraj Raval
43 Predicting Stock Prices - Learn Python for Data Science #4
Predicting Stock Prices - Learn Python for Data Science #4
Siraj Raval
44 Pong Neural Network (LIVE)
Pong Neural Network (LIVE)
Siraj Raval
45 Deep Dream in TensorFlow - Learn Python for Data Science #5
Deep Dream in TensorFlow - Learn Python for Data Science #5
Siraj Raval
46 Visualizing Data with D3.js (LIVE)
Visualizing Data with D3.js (LIVE)
Siraj Raval
47 Genetic Algorithms - Learn Python for Data Science #6
Genetic Algorithms - Learn Python for Data Science #6
Siraj Raval
48 Enter Siraj [Music Video]
Enter Siraj [Music Video]
Siraj Raval
49 Build a Web Scraper (LIVE)
Build a Web Scraper (LIVE)
Siraj Raval
50 Why is P vs NP Important?
Why is P vs NP Important?
Siraj Raval
51 How to Make a Neural Network (LIVE)
How to Make a Neural Network (LIVE)
Siraj Raval
52 How to Make an Amazing Tensorflow Chatbot Easily
How to Make an Amazing Tensorflow Chatbot Easily
Siraj Raval
53 How to Make an Amazing Video Game Bot Easily
How to Make an Amazing Video Game Bot Easily
Siraj Raval
54 How to Make a Tensorflow Neural Network (LIVE)
How to Make a Tensorflow Neural Network (LIVE)
Siraj Raval
55 How to Make a Simple Tensorflow Speech Recognizer
How to Make a Simple Tensorflow Speech Recognizer
Siraj Raval
56 Joel Shor - Really Quick Questions with an Awesome Google Engineer
Joel Shor - Really Quick Questions with an Awesome Google Engineer
Siraj Raval
57 How to Make a Path Planning Algorithm Easily (LIVE)
How to Make a Path Planning Algorithm Easily (LIVE)
Siraj Raval
58 The Best Way to Prepare a Dataset Easily
The Best Way to Prepare a Dataset Easily
Siraj Raval
59 Catherine Olsson - Really Quick Questions with an OpenAI Engineer
Catherine Olsson - Really Quick Questions with an OpenAI Engineer
Siraj Raval
60 How to Make a Tic Tac Toe Neural Network Easily (LIVE)
How to Make a Tic Tac Toe Neural Network Easily (LIVE)
Siraj Raval

This video teaches tone analysis, a technique used to understand the meaning behind words, including sentiment, emotions, and style, and demonstrates how to implement it using IBM's Watson API.

Key Takeaways
  1. Sign up for IBM's Bluemix cloud service
  2. Create a new Watson Tone Analyzer service
  3. Generate a new Node Express web app using npm and the express generator module
  4. Import the Watson Developer Cloud module
  5. Create routes for the index page
  6. Initialize the tone analyzer variable and call the tone function using user input
💡 Tone analysis can be used to better understand the meaning behind words and improve writing clarity

Related AI Lessons

Want to get started with deep learning
Get started with deep learning by leveraging resources like Andrew Karpathy's playlist and frameworks such as TensorFlow or PyTorch
Reddit r/deeplearning
Building a Deepfake Detector From Scratch — What Nobody Tells You
Learn to build a deepfake detector from scratch and understand the challenges involved in detecting AI-generated fake media
Medium · Deep Learning
Unfolding the Meandering Path: High-Dimensional Invariance and the Flat 2D Plane of Neural…
Learn about high-dimensional invariance and its relation to the flat 2D plane of neural networks, and how to apply these concepts to improve model performance
Medium · Deep Learning
Implementing Neural Style Transfer from Scratch: The Project That Started It All
Learn to implement Neural Style Transfer from scratch and understand its significance in deep learning
Medium · Deep Learning
Up next
Image Classification with ml5.js
The Coding Train
Watch →