Understanding Sentiment Analysis

Sentiment analysis is the process of analyzing the polarity of some given text. It can be of any kind - reviews, opinion mining and analyzing general response. Sentiment analysis is a machine learning technique. Using some algorithms, one can mine about what a certain document conveys. The result can fall into any of the classes - positive, negative and neutral. They can also be numerical classes to grade some document. So, it is basically, a kind of judgmental analysis of anything. To understand sentiment analysis, we need to understand certain areas of machine learning.
Machine learning can be divided into two categories: supervised and unsupervised learning. Supervised learning uses algorithms with a defined input and the expected output, whereas, in unsupervised learning, we have the input with no given desired outcome. Here, sentiment analysis focusses on supervised learning.

To perform text mining or analysis for our sentiment analytics tool, we first need a corpus. A corpus is a database of several thousand sentences belonging to any of the outcome classes. The corpus acts as the database from which our program/tool is trained on. The next step is to make it understand what kind of vocabulary is used. This step involves segregating our corpus into the category classes with the word.

Second step of sentiment analysis to segregate sentence into score.
Image source: https://www.kdnuggets.com/2018/04/understanding-behind-sentiment-analysis-part-1.html
The neutral word might end up being on either side to prevent certain logical errors. Even positive words might end up being on the side containing negative sentences. The idea is to split the positive and negative sentences and work on words later. The third step involves calculating the sentiment value and assigning it to the result as required. This step uses the mathematical logic of the bigger number. We give the positive word a higher score, neutral a zero score, and negative a small score. Then based on the sentence's score, the output score can tell about its general sentiment. Look at this example:

Positive = I (1.01) * loved (1.01) * that (1.01) * movie (1.01) = 1.04
Negative = I (1.01) * hated (0.01) * that (1.01) * movie (1.01) = 0.01

This logic is a simplified version of the Naïve Bayes classifier using the Naïve Bayes theorem. This model works for most short and direct sentences. Additionally, the utility and grammar varies from language to language.


This is one example of a sentiment analysis done on a text database. There are several kinds of sentiment analysis techniques available using different algorithms. Even this is not perfect and it is possible to tune the model better. As with all ML algorithms, the accuracy of results depends on our model. The better the model is tuned to our requirements, the better the result. In case of deep learning, the greater the amount of data fed, the greater the accuracy of the neural network. These are the basics of how a simple sentiment analysis is done. For more on this, learn Sentiment Analysis & Deep Learning from our centers in Kolkata. Our Deep Learning Kolkata centers can explain more about neural networks and sentiment analysis.

Are You A Deep Learning Aspirant?


Leave a Reply

Your email address will not be published. Required fields are marked *