RJOCS (Riau Journal of Computer Science)
Vol. 12 No. 2 (2026): RJOCS (Riau Journal of Computer Science)

ANALISIS SENTIMEN PROGRAM MAKAN BERGIZI GRATIS DI MEDIA SOSIAL X MENGGUNAKAN TF-IDF DAN PERBANDINGAN ALGORITMA MACHINE LEARNING

Weliansyah Weliansyah (Institut Sains dan Bisnis Atma Luhur)
Muhamad Kurniawan (Universitas Pertiba)



Article Info

Publish Date
30 Jul 2026

Abstract

The Free Nutritional Meal Program (MBG) is a government policy that has generated various public responses on social media X. The large volume of opinions generated makes sentiment analysis an effective approach to automatically identify public perception. This study aims to analyze public sentiment towards the Free Nutritional Meal Program and compare the performance of the Naive Bayes, Logistic Regression, and Support Vector Machine (SVM) algorithms in classifying sentiment. The study uses a quantitative approach based on Natural Language Processing (NLP) with stages of data collection, preprocessing, sentiment labeling using a lexicon approach, feature extraction using Term Frequency–Inverse Document Frequency (TF-IDF), data division using Stratified Train-Test Split, validation using Stratified K-Fold Cross Validation, parameter optimization through GridSearchCV, and model evaluation using Accuracy, Precision, Recall, F1-Score, Confusion Matrix, and ROC Curve. The results show that the crawling process produced 2,798 tweets, then after preprocessing obtained 2,703 tweets used in the classification process. The sentiment distribution shows a predominance of positive sentiment towards the Free Nutritional Meal Program. All algorithms performed well in classification after parameter optimization. Based on the evaluation results, Logistic Regression performed best, followed by Support Vector Machine, while Naive Bayes yielded competitive results as a comparison model. This study demonstrates that the combination of preprocessing, lexicon-based labeling, TF-IDF feature extraction, and model optimization produces effective sentiment classification and can be utilized to support data-driven public policy evaluation.

Copyrights © 2026






Journal Info

Abbrev

rjocs

Publisher

Subject

Computer Science & IT

Description

Riau Journal of Computer Science diterbitkan dengan maksud untuk mengumpulkan artikel ilmiah dari peneliti, pemakalah, inovasi, prosiding seminar dan konsep ilmu pengetahuan dalam bidang ilmu komputer, informatika, sistem informasi atau yang relevan, kemudian mempublikasikan artikel tersebut. Riau ...