The presence of electric vehicles has generated diverse public opinions on social media, creating the need for an automated approach to sentiment identification. Transformer-based models such as IndoBERT can capture semantic context more effectively than conventional machine learning methods that rely on feature representations such as TF-IDF, which are less effective in modeling word relationships, particularly in imbalanced datasets. This study aims to analyze public sentiment toward electric vehicles using an IndoBERT model optimized with Grid Search and compare its performance with Naive Bayes and Support Vector Machine (SVM). An experimental method was applied to a dataset of 1,517 Indonesian-language opinions. IndoBERT was fine-tuned using Grid Search by evaluating hyperparameter combinations of epochs (3, 4, and 5), learning rates (2e-5 and 3e-5), and a batch size of 16. Model performance was evaluated using accuracy, precision, recall, F1-score, and ROC-AUC. The best IndoBERT configuration was obtained with 5 epochs, a learning rate of 3e-5, and a batch size of 16, achieving 73% accuracy. Although its accuracy matched that of SVM, IndoBERT produced more balanced results, with a macro F1-score of 0.62 and the highest average AUC (0.780), outperforming SVM (0.758) and Naive Bayes (0.736). The novelty of this study lies in optimizing IndoBERT using Grid Search and comparing it with Naive Bayes and SVM based on ROC-AUC for Indonesian-language electric vehicle sentiment analysis. The findings demonstrate that Grid Search optimization enhances IndoBERT's contextual understanding, resulting in superior overall performance.
Copyrights © 2026