Comparison of Random Forest Algorithm Classifier and Naïve Bayes Algorithm in Whatsapp Message Type Classification - Abdul Hadi; Mukti Qamal; Yesy Afrillia (Institute for Research and Community Service (LPPM), Universitas Malikussaleh, Indonesia, 2025)
This study compares the effectiveness of Random Forest and Naïve Bayes algorithms in classifying WhatsApp messages into three categories: normal, promotional, and fraudulent messages. With over 2.78 billion active users worldwide and 90% of Indonesian internet users utilizing WhatsApp, the platform's end-to-end encryption creates challenges for automatic spam detection, necessitating machine learning approaches. A dataset of 300 messages, equally distributed across the three categories, underwent preprocessing including cleansing, case folding, stopword removal, normalization, and stemming before being converted to numerical form using TF-IDF vectorization. Experimental results demonstrated that Naïve Bayes outperformed Random Forest with higher accuracy (88.67% vs. 86.00%), precision (89.64% vs. 88.95%), recall (88.67% vs. 86.00%), and F1-score (88.61% vs. 85.99%). Cross-validation analysis with 10-fold validation further confirmed Naïve Bayes' superior consistency and stability across all evaluation metrics. Additionally, Naïve Bayes exhibited remarkable computational efficiency, requiring only 0.13 seconds for training compared to Random Forest's 3.65 seconds. Confusion matrix analysis revealed Naïve Bayes' particular effectiveness in distinguishing between normal and fraudulent messages, crucial for preventing users from falling victim to scams. The model successfully identified key fraud indicators such as