Natural Language Processing vs. Machine Learning vs. Deep Learning
[Updated on on ]
NLP, Machine Learning and Deep Learning are all parts of Artificial Intelligence, which is a part of the greater field of Computer Science. The following image visually illustrates CS, AI and some of the components of AI -
- Robotics (AI for motion)
- Vision (AI for visual space - videos, images)
- NLP (AI for text)
There are other aspects of AI too which are not highlighted in the image - such as speech, which is beyond the scope of this post. Here is what I discuss in this post:
- What is Natural Language Processing?
- Machine Learning
- Deep Learning
- Relationship between NLP, ML and Deep Learning
What is Natural Language Processing?
Natural Language Processing (or NLP) is an area that is a confluence of Artificial Intelligence and linguistics. It involves intelligent analysis of written language.
If you have a lot of data written in plain text and you want to automatically get some insights from it, you need to use NLP.
Some applications of NLP are:
- Sentiment Analysis : Classification of emotion behind text content. e.g. movie reviews are good or bad. How can humans tell if a review is good or bad? Can use use the same features that humans use - presence of describing words (adjectives) such as “great” or “terrible” etc.?
- Information extraction : Extracting structured data from text. e.g. relationships between country and name of president, acquisition relationship between buyer and seller etc.
- Information retrieval : This is a synonym of search. It is the concept of retrieving the correct document given a query - like Google! For the curious, here is info on how to build your own search engine and some more details on the internals of Lucene (Apache Lucene is an open source search engine that is used in Elastic Search)
Here is a more detailed post about NLP - What is Natural Language Processing?
Machine Learning (or ML) is an area of Artificial Intelligence (AI) that is a set of statistical techniques for problem solving.
Machine Learning by itself is a set of algorithms that is used to do better NLP, better vision, better robotics etc. It is not an AI field in itself, but a way to solve real AI problems.
Today ML is used for self driving cars (vision research from graphic above), fraud detection, price prediction, and even NLP.
In order to apply ML techniques to NLP problems, we need to usually convert the unstructured text into a structured format, i.e. tabular format.
Deep Learning (which includes Recurrent Neural Networks, Convolution neural Networks and others) is a type of Machine Learning approach.
Deep Learning is an extension of Neural Networks - which is the closest imitation of how the human brains work using neurons. Mathematically it involves running data through a large networks of neurons - each of which has an activation function - the neuron is activated if that threshold is reached - and that value is propagated through the network.
Deep Learning is used quite extensively for vision based classification (e.g. distinguishing images of airplanes from images of dogs).
Deep Learning can be used for NLP tasks as well. However it is important to note that Deep Learning is a broad term used for a series of algorithms and it is just another tool to solve core AI problems that are highlighted above.
Relationship between NLP, ML and Deep Learning
The image below shows graphically how NLP is related ML and Deep Learning. Deep Learning is one of the techniques in the area of Machine Learning - there are several other techniques such as Regression, K-Means, and so on.
ML and NLP have some overlap, as Machine Learning as a tool is often used for NLP tasks. There are several other things that you need for NLP - NER (named entity recognizer), POS Tagged (Parts of peech tagger identifies Nouns, verbs and other part of speech tags in text).
NLP has a strong linguistics component (not represented in the image), that requires an understanding of how we use language. The art of understanding language involves understanding humor, sarcasm, subconscious bias in text, etc.
Once we can understand that is means to to be sarcastic (yeah right!) we can encode it into a machine learning algorithm to automatically discover similar patterns for us statistically.
To summarize, in order to do any NLP, you need to understand language. Language is different for different genres (research papers, blogs, twitter have different writing styles), so there is a strong need of looking at your data manually to get a feel of what it is trying to say to you, and how you - as a human would analyze it.
Once you figure out what you are doing as a human reasoning system (ignoring hash tags, using smiley faces to imply sentiment), you can use a relevant ML approach to automate that process and scale it.