Back to projects

Drug Review Sentiment Analysis

NLP·2026
Drug Review Sentiment Analysis

A controlled comparison of five model families on patient drug reviews, classifying each as negative, neutral or positive. Try the live model in the embedded demo.

Technologies:

NLPPythonTransformersRoBERTaScikit-learn

Details:

This project frames patient drug reviews as a three-class sentiment problem (negative, neutral, positive) and runs a large, controlled comparison of how different model families handle medical text.

Five model families are evaluated: ComplementNB, TF-IDF with Logistic Regression, VADER, RoBERTa, and Longformer. Each is assessed in both a baseline and a hyperparameter-tuned variant, trained across three versions of the data (original, back-translation augmented, and paraphrase augmented), and scored on a single frozen test set to keep the comparison fair.

Beyond raw performance, the study examines how data augmentation behaves on an imbalanced dataset, applies SHAP and token-level attributions to explain individual predictions, and stress-tests each model against a hand-crafted adversarial set built to trigger common failure modes such as sarcasm, negation, and mixed sentiment.

The aim is a rigorous comparison of classical machine learning against transformer approaches for medical-text sentiment, rather than chasing a single headline model. You can try the deployed models in the live demo below.