Tone Analysis - Fresh Machine Learning #3
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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
▶
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
What is Bitcoin?
Siraj Raval
5 Ways to Use Bitcoin
Siraj Raval
BTC Fever - Siraj [Music Video]
Siraj Raval
5 Reasons to Build Decentralized Apps
Siraj Raval
The Interplanetary File System
Siraj Raval
How to Build a Dapp in 3 min
Siraj Raval
Life Before Smartphones
Siraj Raval
4 Ways to Use Smart Contracts
Siraj Raval
3 Dapps You HAVE to See
Siraj Raval
Char's Life as a BitTorrent Engineer
Siraj Raval
4 Reasons AlphaGo is a Huge Deal
Siraj Raval
Build a Neural Net in 4 Minutes
Siraj Raval
Sentiment Analysis in 4 Minutes
Siraj Raval
The Hackathon Life
Siraj Raval
Your First ML App - Machine Learning for Hackers #1
Siraj Raval
Build an AI Composer - Machine Learning for Hackers #2
Siraj Raval
Build a Game AI - Machine Learning for Hackers #3
Siraj Raval
Build a Movie Recommender - Machine Learning for Hackers #4
Siraj Raval
Build an AI Artist - Machine Learning for Hackers #5
Siraj Raval
Build a Chatbot - ML for Hackers #6
Siraj Raval
Build an AI Reader - Machine Learning for Hackers #7
Siraj Raval
Build an AI Writer - Machine Learning for Hackers #8
Siraj Raval
Build a Chatbot w/ an API - ML for Hackers #9
Siraj Raval
One-Shot Learning - Fresh Machine Learning #1
Siraj Raval
Generative Adversarial Nets - Fresh Machine Learning #2
Siraj Raval
Tone Analysis - Fresh Machine Learning #3
Siraj Raval
Generate Rap Lyrics - Fresh Machine Learning #4
Siraj Raval
Build an Autoencoder in 5 Min - Fresh Machine Learning #5
Siraj Raval
Build a Self Driving Car in 5 Min - Fresh Machine Learning #6
Siraj Raval
Build an Antivirus in 5 Min - Fresh Machine Learning #7
Siraj Raval
TensorFlow in 5 Minutes (tutorial)
Siraj Raval
Build a Recurrent Neural Net in 5 Min
Siraj Raval
Build a Simulation in 5 Min
Siraj Raval
Build a TensorFlow Image Classifier in 5 Min
Siraj Raval
Tensorboard Explained in 5 Min
Siraj Raval
Generate Music in TensorFlow
Siraj Raval
Build a Game Bot (LIVE)
Siraj Raval
Deep Learning Frameworks Compared
Siraj Raval
Introduction - Learn Python for Data Science #1
Siraj Raval
Build a Neural Network (LIVE)
Siraj Raval
Twitter Sentiment Analysis - Learn Python for Data Science #2
Siraj Raval
Recommendation Systems - Learn Python for Data Science #3
Siraj Raval
Predicting Stock Prices - Learn Python for Data Science #4
Siraj Raval
Pong Neural Network (LIVE)
Siraj Raval
Deep Dream in TensorFlow - Learn Python for Data Science #5
Siraj Raval
Visualizing Data with D3.js (LIVE)
Siraj Raval
Genetic Algorithms - Learn Python for Data Science #6
Siraj Raval
Enter Siraj [Music Video]
Siraj Raval
Build a Web Scraper (LIVE)
Siraj Raval
Why is P vs NP Important?
Siraj Raval
How to Make a Neural Network (LIVE)
Siraj Raval
How to Make an Amazing Tensorflow Chatbot Easily
Siraj Raval
How to Make an Amazing Video Game Bot Easily
Siraj Raval
How to Make a Tensorflow Neural Network (LIVE)
Siraj Raval
How to Make a Simple Tensorflow Speech Recognizer
Siraj Raval
Joel Shor - Really Quick Questions with an Awesome Google Engineer
Siraj Raval
How to Make a Path Planning Algorithm Easily (LIVE)
Siraj Raval
The Best Way to Prepare a Dataset Easily
Siraj Raval
Catherine Olsson - Really Quick Questions with an OpenAI Engineer
Siraj Raval
How to Make a Tic Tac Toe Neural Network Easily (LIVE)
Siraj Raval
More on: LLM Foundations
View skill →Related AI Lessons
⚡
⚡
⚡
⚡
Want to get started with deep learning
Reddit r/deeplearning
Building a Deepfake Detector From Scratch — What Nobody Tells You
Medium · Deep Learning
Unfolding the Meandering Path: High-Dimensional Invariance and the Flat 2D Plane of Neural…
Medium · Deep Learning
Implementing Neural Style Transfer from Scratch: The Project That Started It All
Medium · Deep Learning
🎓
Tutor Explanation
DeepCamp AI