Sentiment Analysis using NLP

Sentiment Analysis


Sentiment Analysis is defined as the process of mining of data, views, sentences, comments to predict the emotion, feeling of the sentence through Natural Processing Language (NLP). The analysis involves the classification of text into three phases as positive, negative, and neutral. Sentiment Analysis is widely applied to reviews and survey responses, online social media, and many healthcare materials for applications.


Cleaning, pre-processing, and normalization of unwanted phrases or words to some standard format. There will be some irrelevant symbols, characters that create noise. So, to build meaningful features we have to enable standardization.

Sentiment Analysis Using Supervised Learning

  1. Prepare train and test datasets
  2. Pre-process and normalize text documents
  3. Feature engineering
  4. Model training
  5. Model prediction and evaluation
  1. Logistic Regression with TFIDF
  2. Support Vector Machines (SVM) with bag of words
  3. Support Vector Machines TFIDF
Performance metrices of Logistic Regression (BOW) (Supervised Learning)
Performance metrices of Logistic Regression (TFIDF) (Supervised Learning)
Performance metrices of SVM (BOW) (Supervised Learning)
Performance metrices of SVM (TFIDF) (Supervised Learning)

Sentiment Analysis Using Unsupervised Learning Lexicon Based

  1. AFINN
  2. SentiWordNet
  3. VADER
Performance metrices of Afinn (Unsupervised Learning)
Performance metrices of SentiWordNet (Unsupervised Learning)
Performance metrics of Vader (Unsupervised Learning)


Since going through Supervised and Unsupervised learning, comparison between accuracy and f1 score. We came to know that Supervised learning is better than Unsupervised learning as it gives an accuracy of 90.59% and F1 score of 90.62%, while Unsupervised learning gave an accuracy of 71.18% and F1 score of 74.68%.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store