Skip to main content
QUICK REVIEW

[Paper Review] Sentiment Analysis in Drug Reviews using Supervised Machine Learning Algorithms

Sairamvinay Vijayaraghavan, Debraj Basu|arXiv (Cornell University)|Mar 21, 2020
Sentiment Analysis and Opinion MiningComputer Science2 references27 citations
TL;DR

This study applies supervised machine learning to sentiment analysis in drug reviews using TF-IDF and Count Vectorizer embeddings, evaluating models including neural networks (ANN, LSTM, GRU) and traditional algorithms (SVM, Logistic Regression, Random Forest). Results show that deep learning models with Count Vectorizer outperform other combinations, achieving up to 93.85% test accuracy on birth control reviews, with RNN variants (LSTM/GRU) performing similarly and Random Forests performing worst.

ABSTRACT

Sentiment Analysis is an important algorithm in Natural Language Processing which is used to detect sentiment within some text. In our project, we had chosen to work on analyzing reviews of various drugs which have been reviewed in form of texts and have also been given a rating on a scale from 1-10. We had obtained this data set from the UCI machine learning repository which had 2 data sets: train and test (split as 75-25\%). We had split the number rating for the drug into three classes in general: positive (7-10), negative (1-4) or neutral(4-7). There are multiple reviews for the drugs that belong to a similar condition and we decided to investigate how the reviews for different conditions use different words impact the ratings of the drugs. Our intention was mainly to implement supervised machine learning classification algorithms that predict the class of the rating using the textual review. We had primarily implemented different embeddings such as Term Frequency Inverse Document Frequency (TFIDF) and the Count Vectors (CV). We had trained models on the most popular conditions such as "Birth Control", "Depression" and "Pain" within the data set and obtained good results while predicting the test data sets.

Motivation & Objective

  • To investigate the effectiveness of supervised machine learning in classifying sentiment in drug reviews based on textual content and associated ratings.
  • To compare the performance of different text embedding techniques—TF-IDF and Count Vectorizer—on sentiment classification tasks.
  • To evaluate a range of machine learning and deep learning models (e.g., ANN, LSTM, GRU, SVM, Logistic Regression, Random Forest) in predicting sentiment classes derived from drug review ratings.
  • To determine whether contextual word usage and feature representation significantly influence sentiment prediction accuracy in medical text.

Proposed method

  • Textual drug reviews were preprocessed and converted into sentiment classes: positive (7–10), negative (1–4), and neutral (4–7), transforming a regression task into a multi-class classification problem.
  • Two text vectorization techniques were applied: Term Frequency-Inverse Document Frequency (TF-IDF) and Count Vectorizer (CV), both converting raw text into numeric feature matrices.
  • A diverse set of classifiers was trained and evaluated, including deep learning models (ANN, LSTM, GRU) and traditional ML models (SVM, Logistic Regression, Random Forest), using 10-fold cross-validation on training data and testing on unseen data.
  • Hyperparameter tuning was performed using grid search, with optimal parameters selected based on validation performance, including learning rate, hidden units, and tree depth.
  • Model performance was evaluated using test accuracy, F1-score, ROC and PR curves, and AUC scores to assess generalization and discrimination ability.
  • The study focused on three major medical conditions—Birth Control, Depression, and Pain—to assess model performance across different clinical contexts.

Experimental results

Research questions

  • RQ1Does the choice of text embedding (TF-IDF vs. Count Vectorizer) significantly affect sentiment classification accuracy in drug reviews?
  • RQ2How do deep learning models (e.g., ANN, LSTM, GRU) compare in performance to traditional machine learning models (e.g., SVM, Logistic Regression, Random Forest) for sentiment classification in medical text?
  • RQ3Is there a consistent performance hierarchy among different models across multiple medical conditions (e.g., Birth Control, Depression, Pain)?
  • RQ4To what extent do word counts and word importance (as captured by CV and TF-IDF) influence the model’s ability to predict sentiment from drug reviews?
  • RQ5Why do certain models like Random Forest underperform despite being robust in other NLP tasks?

Key findings

  • Count Vectorizer outperformed TF-IDF across all conditions, achieving the highest test accuracy of 93.85% on the Birth Control dataset, suggesting that raw word frequency is more informative than term importance for sentiment prediction.
  • Deep learning models (ANN, LSTM, GRU) consistently outperformed traditional machine learning models, with the ANN achieving 93.41% test accuracy on the Pain dataset and 93.85% on Birth Control.
  • LSTM and GRU models performed similarly across all conditions, with F1 scores and AUC values indicating comparable generalization and discrimination performance.
  • SVM and Logistic Regression showed similar performance patterns, with SVM slightly outperforming Logistic Regression, particularly on TF-IDF features, likely due to margin-based classification being more effective than probabilistic thresholding.
  • Random Forest models performed the worst across all conditions, with test accuracy below 62% on all datasets, indicating poor generalization on this task, possibly due to limited feature interaction learning.
  • The best-performing model combination was ANN with Count Vectorizer, achieving 93.85% accuracy on Birth Control, 92.11% on Depression, and 91.29% on Pain, confirming the superiority of deep learning with raw word counts.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.