Quality-Controlled Indonesian Twitter Sentiment Analysis Baseline Using TF-IDF and Classical Machine Learning Approaches
Abstract
Social media provides a large volume of informal textual data for examining public sentiment, but Indonesian Twitter content presents substantial challenges due to slang, nonstandard spelling, limited context, and uneven class distribution. This study evaluates a reproducible machine-learning and natural-language-processing pipeline for three-way sentiment classification on a publicly available Indonesian Twitter dataset. The original corpus contained 10,806 manually labeled tweets. Quality control removed duplicate texts and all duplicate texts carrying conflicting labels, yielding 9,948 observations: 2,606 negative, 4,955 neutral, and 2,387 positive. Text was normalized and represented using term frequency-inverse document frequency with unigram and unigram-bigram configurations. Multinomial Naive Bayes, logistic regression, linear support vector machine, and random forest classifiers were evaluated using a stratified 80:20 split, with macro-F1 prioritized due to class imbalance. Multinomial Naive Bayes achieved the highest accuracy at 60.35%, but logistic regression with unigram-bigram features produced the best macro-F1 of 56.22% and a weighted F1 of 58.45%. Five-fold cross-validation produced a mean macro-F1 of 56.59% with low dispersion. Error analysis indicates that negation, mixed sentiment, informal expressions, and context dependence remain major sources of misclassification. These findings establish a transparent classical baseline for Indonesian social-media sentiment analysis.