Source-linked AI summary

Drug Recommendation System based on Sentiment Analysis of Drug Reviews using Machine Learning

Satvik Garg

arXiv:2104.01113v2cs.IRcs.AIcs.LG

TL;DR

Drug recommendation using review sentiment is a relatively little-studied area, while people seek health information online. This paper predicts sentiment from drug reviews with several text representations and uses the predictions to rank drugs; LinearSVC with TF-IDF achieves 93% accuracy.

  • Problem

    Drug recommendation using sentiment analysis is infrequently studied, despite online health searching and the need to choose treatments for patients.

    Source: §I · p. 1
  • Method

    The paper predicts positive or negative sentiment from patient drug reviews using BoW, TF-IDF, Word2Vec, and manually engineered features, then combines model predictions to score drugs.

    Source: B. Feature Extraction · p. 3, §IV · p. 6
  • Results

    93% accuracy: LinearSVC with TF-IDF outperforms the other evaluated models, and its AUC score is 90.7%.

    Source: §IV · p. 6, §VI · p. 7
  • Takeaways & Limitations

    The combined score ranks drugs by model predictions and review helpfulness for each condition.

    Source: §IV · p. 6

    The authors say the framework is not ready for real-life application and needs improved class balancing, hyperparameter optimization, and ensembling.

    Source: §V · p. 6

Abstract

from arXiv · show

Since coronavirus has shown up, inaccessibility of legitimate clinical resources is at its peak, like the shortage of specialists, healthcare workers, lack of proper equipment and medicines. The entire medical fraternity is in distress, which results in numerous individuals demise. Due to unavailability, people started taking medication independently without appropriate consultation, making the health condition worse than usual. As of late, machine learning has been valuable in numerous applications, and there is an increase in innovative work for automation. This paper intends to present a drug recommender system that can drastically reduce specialists heap. In this research, we build a medicine recommendation system that uses patient reviews to predict the sentiment using various vectorization processes like Bow, TFIDF, Word2Vec, and Manual Feature Analysis, which can help recommend the top drug for a given disease by different classification algorithms. The predicted sentiments were evaluated by precision, recall, f1score, accuracy, and AUC score. The results show that classifier LinearSVC using TFIDF vectorization outperforms all other models with 93% accuracy.

I. INTRODUCTION

The introduction motivates drug recommendation with clinician shortages, difficult treatment choices, and growing online health information seeking. The literature survey describes related systems while noting limited work on drug recommendations based on sentiment analysis.

I. INTRODUCTION

  • The introduction links clinician shortages, especially in rural areas, with the long 6-to-12-year qualification period for doctors.It argues that doctor numbers cannot be expanded quickly and calls for telemedicine during the crisis.Source: §I · p. 1
  • Online health searches and diagnosis-seeking are common, while the authors describe medication recommender systems as a way to assist doctors and inform patients about drugs for specific conditions.The cited 2013 survey reports that about 60% of adults searched online for health topics and about 35% sought online diagnoses.Source: §I · p. 1

II. LITERATURE SURVEY

  • Limited studies address drug recommendation using sentiment analysis, although medication reviews are complex because they contain clinical terminology.The text notes that reviews may include disease names, side effects, and chemical names used in drug production.Source: §II · p. 2
  • Prior work includes GalenOWL, which recommends drugs using a patient’s condition, allergies, and drug interactions, and treatment-record systems that seek suitable regimens for new patients [10].The treatment-record framework was tested using electronic medical records gathered from multiple clinics and reported improved cure rates.Source: §II · p. 2
  • Other surveyed approaches include risk-level classification for first-line drug selection, SVM-based treatment recommendation, and cloud-assisted top-N suggestions based on symptoms.The cloud-assisted system shifted from collaborative filtering to tensor decomposition after noting computational cost, cold start, and information sparsity.Source: §II · p. 2

III. METHODOLOGIES

The study uses the Drugs.com review dataset from the UCI ML repository to develop a medicine recommender. Its proposed model has four stages, from data preparation through recommendation.

III. METHODOLOGIES

  • The Drugs.com dataset contains 215,063 instances and six attributes: drug name, patient review, condition, useful count, review date, and 10-star rating.The dataset is identified as coming from the UCI ML repository.Source: §III · p. 2
  • The proposed model proceeds through data preparation, classification, evaluation, and recommendation.Fig. 1 presents the model as a flowchart.Source: §III · p. 2, Figure 1 · p. 2

A. Data Cleaning and Visualisation

Data cleaning removes null condition rows and meaningless conditions before analysis. The section also visualizes condition availability and the distribution of patient ratings.

A. Data Cleaning and Visualisation

  • The conditions column is reported to have 1,200 null-value rows, while the preparation process checks that each ID is unique in order to remove duplicacy.Source: A. Data Cleaning and Visualisation · p. 3
  • Removing meaningless conditions leaves 212,141 rows in the final dataset.Fig. 3 shows the top 20 conditions with the most drugs available; two green columns indicate conditions deemed meaningless.Source: A. Data Cleaning and Visualisation · p. 3, Figure 3 · p. 3
  • The 10-star rating distribution is polarized and leans positive, with ratings of five or below treated as negative and ratings above five as positive.Fig. 4 visualizes rating counts; ratings at or below five are cyan and higher ratings are blue.Source: A. Data Cleaning and Visualisation · p. 3, Figure 4 · p. 3
  • Before vectorization, reviews are cleaned by removing HTML tags, punctuation, quotes, and URLs, then lowercased, tokenized, and lemmatized after stopword removal.Condition and drug columns are joined to review text because those words also have predictive power.Source: A. Data Cleaning and Visualisation · p. 3

B. Feature Extraction

The feature extraction section converts review text into numerical representations for classification and compares three text-vectorization methods with manually engineered features.

B. Feature Extraction

  • The study represents review text using bag of words, TF-IDF, and Word2Vec, and also creates a model from manually engineered review features.These numerical features are used because machine-learning algorithms cannot work directly with text.Source: B. Feature Extraction · p. 3

1) Bow:

The section presents bag-of-words and TF-IDF as text-vectorization methods, describing their representations and limitations. Both use a (1,2) n-gram range in this study.

1) Bow:

  • Bag of words counts token occurrences and uses a (1,2) n-gram range; the figure illustrates unigrams, digrams, and trigrams framed from a sentence.The paper notes that counting all terms can create a large, computationally expensive matrix.Source: 1) Bow · p. 3, Figure 5 · p. 3

2) TF-IDF:

  • TF-IDF weights words rather than simply counting them, giving less importance to terms that appear frequently across the dataset.Term frequency reflects the likelihood of finding a word in a document, while inverse document frequency captures how document-specific a term is.Source: 2) TF-IDF · p. 4
  • TF-IDF uses a (1,2) n-gram range in this work.Source: 2) TF-IDF · p. 4

3) Word2Vec:

Word2Vec represents words as vectors intended to place words with similar meanings near one another. The paper also constructs a manual-feature model using review and contextual features.

3) Word2Vec:

  • Word2Vec takes a large text corpus and produces a vector space in which words with similar senses are positioned near one another.The paper contrasts this with TF and TF-IDF, which disregard semantic and syntactic similarities between words.Source: 3) Word2Vec · p. 4
  • Word2Vec is presented as an embedding approach, whereas TF and TF-IDF treat near-synonyms such as “lovely” and “delightful” as distinct words.Source: 3) Word2Vec · p. 4

4) Manual Features:

  • The manual-feature model uses 15 features, including useful count, encoded condition, date-derived fields, and review polarity.TextBlob supplies polarity for cleaned and uncleaned reviews, alongside eight features generated from each review.Source: 4) Manual Features · p. 4

C. Train Test Split

The study splits four representation datasets into training and testing sets, then applies SMOTE only to training data to address class imbalance. The paper describes the resulting class balance in a t-SNE projection.

C. Train Test Split

  • The four datasets—Bow, TF-IDF, Word2Vec, and manual features—were split into 75% training and 25% testing using the same random state.Source: C. Train Test Split · p. 4
  • Table I lists the features extracted manually from user reviews.Source: Table I · p. 4

D. Smote

  • SMOTE was applied only to training data; the t-SNE projection of 1,000 manual-feature samples shows more blue points after oversampling, which the paper describes as bringing class balance.Source: D. Smote · p. 4, Figure 6 · p. 4
  • Table II reports the final dataset distribution after data cleaning.Source: D. Smote · p. 4, Table II · p. 4

E. Classifiers

The study compares classifiers suited to different text representations and evaluates predicted sentiment with five metrics. Algorithm choices also reflect the dataset’s computational demands.

E. Classifiers

  • Sparse BoW and TF-IDF representations were tested with Logistic Regression, Multinomial Naive Bayes, SGD, LinearSVC, Perceptron, and Ridge; Word2Vec and manual features used tree-based classifiers.The authors selected algorithms intended to reduce training time and produce faster predictions for a dataset of around 210K reviews.Source: E. Classifiers · p. 5

F. Metrics

  • Five metrics—precision, recall, F1 score, accuracy, and AUC—were used to evaluate predicted sentiment.The paper describes AUC as distinguishing a classifier’s capacity to compare classes and relates the ROC curve to true- and false-positive rates across thresholds.Source: F. Metrics · p. 5
  • Accuracy is calculated from true positives and true negatives relative to all four confusion-matrix outcomes.The passage provides the accuracy equation and defines TP, TN, FP, and FN.Source: F. Metrics · p. 5

G. Drug Recommender system

Across the tested representations, LinearSVC with TF-IDF was selected as the best classifier. The recommender combines the strongest model predictions with normalized review useful counts to rank drugs by condition.

G. Drug Recommender system

  • About 1,300 separates the least and most extreme useful counts, with deviation 36, motivating normalization before drug scoring.Useful counts are normalized by condition and multiplied by the combined prediction to score a drug.Source: G. Drug Recommender system · p. 5, Figure 7 · p. 5

IV. RESULTS

  • 89%–91% accuracy was reported across BoW algorithms, with Perceptron outperforming the others; Logistic Regression and LinearSVC each reached 90% AUC.Perceptron’s AUC was 89.8%, below the 90% AUC of Logistic Regression and LinearSVC.Source: §IV · p. 5, Table III · p. 5
  • 93% accuracy was achieved by LinearSVC with TF-IDF, exceeding the 91% BoW Perceptron accuracy; its 90.7% AUC was higher than the other algorithms.Table IV presents the TF-IDF results; the paper identifies LinearSVC as the best algorithm based on AUC.Source: §IV · pp. 5–6, Table IV · p. 6
  • 91% accuracy and 88.3% AUC were achieved by LGBM on Word2Vec, the best scores among the tested Word2Vec classifiers.The passage says Decision Tree performed poorly but gives no accuracy value for it.Source: §IV · p. 6, Table V · p. 6
  • 88% accuracy was achieved by Random Forest on manually created review features, though the paper describes the method’s results as less impressive than the other text-classification methods.Table VI reports four classifiers on manually created features.Source: §IV · p. 6, Table VI · p. 6
  • The recommender combines the best predictions from Perceptron (BoW), LinearSVC (TF-IDF), LGBM (Word2Vec), and Random Forest (manual features) to score drugs.It multiplies the combined predictions by normalized useful count, divides by the number of drugs per condition to obtain a mean score, and presents four recommendations for each of five conditions.Source: §IV · p. 6, Figure 8 · p. 6

V. DISCUSSION

The authors describe the recommender as a methodology demonstration rather than a system ready for real-world application.

V. DISCUSSION

  • The framework is not yet ready for real-world use; the authors call for better class balancing, hyperparameter optimization, and proper ensembling.The current approach simply adds the best predictions from each method.Source: §V · p. 6
  • The paper’s stated scope is demonstrating a methodology for extracting sentiment from reviews, classifying it, and building a recommender.Source: §V · p. 6

VI. CONCLUSION

The conclusion reports that LinearSVC with TF-IDF outperformed the tested models and describes a drug recommender built from four classifiers’ predictions and normalized useful counts. It also identifies further evaluation and optimization as future work.

VI. CONCLUSION

  • 93% accuracy was reported for LinearSVC with TF-IDF, the best result; Decision Tree with Word2Vec had the worst accuracy at 78%.Source: §VI · p. 7
  • The recommender combines the best predictions from four methods and multiplies them by normalized useful count to score drugs by condition.The four selected models achieved 91% accuracy for BoW Perceptron, 93% for TF-IDF LinearSVC, 91% for Word2Vec LGBM, and 88% for manual-feature Random Forest.Source: §VI · p. 7
  • Future work includes comparing oversampling techniques, testing different n-gram values, and optimizing algorithms to improve recommender performance.Source: §VI · p. 7
Loading 2104.01113v2…