Abstract
Sentiment analysis is a crucial problem in natural language processing (NLP), allowing algorithms to identify and analyze subjective information in text. Despite the rapid evolution of sentiment analysis techniques, prior research has largely lacked unified, reproducible evaluations directly comparing conventional machine learning models with deep learning architectures, particularly across diverse word embedding strategies. This study presents a comprehensive comparative analysis of sentiment classification models, systematically evaluating both conventional machine learning techniques (e.g., SVM, Naive Bayes, Decision Tree, Random Forest) and advanced deep learning architectures (CNN, RNN, LSTM, BERT-LSTM) across various datasets (IMDB, Yelp, Amazon). We employ various word embedding methodologies, including TF-IDF, Word2Vec, GloVe, FastText, and BERT, to assess their impact on model efficacy. BERT-LSTM achieved the best overall performance across datasets (IMDB: 94.0%, Yelp: 94.0%, Amazon: 96.0% accuracy). In contrast, traditional machine learning models such as Naive Bayes and SVM generally achieved lower accuracy than deep contextual models across the evaluated datasets. Experimental results further show that BERT-LSTM's superior performance stems from its ability to capture bidirectional contextual dependencies, improving contextual modelling of complex linguistic constructs. However, sarcasm and negation remain important sources of error. To enhance repeatability, we provide detailed hyperparameter tuning procedures, hardware configurations, and all preprocessing steps, model configurations, and evaluation protocols are described in the manuscript to support independent replication. A targeted error analysis is conducted to systematically examine misclassifications arising from ambiguous language use and sarcastic expressions, highlighting key limitations of existing models. In light of BERT's computational requirements, we investigate pragmatic deployment techniques, such as quantisation (INT8), ONNX Runtime optimisation, and lightweight transformer alternatives (DistilBERT, TinyBERT), that strike a balance between performance and efficiency. INT8 quantisation reduced inference latency by approximately 35–40% under the reported experimental configuration, accompanied by a marginal 1.8% decrease in accuracy. DistilBERT achieved comparable accuracy (91.5%) while processing significantly faster. Although the current experiments focus on English-language datasets, the proposed framework is designed to support future cross-lingual extensions using multilingual models such as mBERT, XLM-R, and IndicBERT. Our findings offer a cohesive perspective on optimizing sentiment models, integrating theoretical frameworks with practical implementation issues, and facilitating the development of scalable, efficient, and interpretable sentiment analysis systems.
Get full access to this article
View all access options for this article.
