Optimasi Kinerja Klasifikasi Naive Bayes dan Random Forest melalui Seleksi Fitur
Abstract
The development of machine learning has improved the capability of data-driven classification systems; however, model performance is highly influenced by the quality and number of features used. Irrelevant or redundant features may increase model complexity and reduce generalization ability. Therefore, an optimization approach such as feature selection is required to obtain more informative features. This study aims to analyze the impact of Chi-Square Feature Selection on optimizing the performance of Naive Bayes and Random Forest classification algorithms. The dataset used in this research is the Breast Cancer Wisconsin Diagnostic Dataset, consisting of 569 samples with 30 numerical features and two target classes. The research stages include data preprocessing, Chi-Square-based feature selection, classification model development using Naive Bayes and Random Forest, and performance evaluation using accuracy, precision, recall, and F1-score. Experiments were conducted by comparing baseline models without feature selection and models using Chi-Square selected features with different feature sizes, including Top 5, Top 10, Top 15, Top 20, and Top 25 features. The results show that Chi-Square Feature Selection improves the performance of both algorithms with different levels of impact. Naive Bayes achieved the best performance using 15 selected features with an accuracy of 94.74% and an F1-score of 95.17%. Meanwhile, Random Forest achieved the highest performance using 5 selected features with an accuracy of 96.49%, precision of 97.22%, recall of 97.22%, and F1-score of 97.22%. These results indicate that Chi-Square Feature Selection can reduce the number of attributes while maintaining and improving classification performance. The combination of Random Forest and Chi-Square Feature Selection provides the best approach in this study by achieving the highest performance with a more optimal feature subset.
References
[2] M. I. Prasetiyowati, N. U. Maulidevi, and K. Surendro, “The accuracy of Random Forest performance can be improved by conducting a feature selection with a balancing strategy,” PeerJ Comput. Sci., vol. 8, p. e1041, 2022, doi: 10.7717/peerj-cs.1041.
[3] M. Shanbehzadeh, H. Kazemi-Arpanahi, M. Bolbolian Ghalibaf, and A. Orooji, “Performance evaluation of machine learning for breast cancer diagnosis: A case study,” Informatics Med. Unlocked, vol. 31, p. 101009, 2022, doi: 10.1016/j.imu.2022.101009.
[4] D. Fahrudy and S. Uyun, “Classification of Student Graduation using Naïve Bayes by Comparing between Random Oversampling and Feature Selections of Information Gain and Forward Selection,” JOIV Int. J. Informatics Vis., vol. 6, no. 4, pp. 798–808, 2022, doi: 10.30630/joiv.6.4.982.
[5] A. P. Permana, T. Chamidy, and C. Crysdian, “Klasifikasi Ulasan Fasilitas Publik Menggunakan Metode Naïve Bayes dengan Seleksi Fitur Chi-Square,” JISKA J. Inform. Sunan Kalijaga, vol. 8, no. 2, pp. 112–124, 2023, doi: 10.14421/jiska.2023.8.2.112-124.
[6] T. Ernayanti, M. Mustafid, A. Rusgiyono, and A. R. Hakim, “Penggunaan Seleksi Fitur Chi-Square dan Algoritma Multinomial Naïve Bayes untuk Analisis Sentimen Pelanggan Tokopedia,” J. Gaussian, vol. 11, no. 4, pp. 562–571, 2023, doi: 10.14710/j.gauss.11.4.562-571.
[7] P. W. Ratiasasadara, S. Sudarno, and T. Tarno, “Analisis Sentimen Penerapan PPKM pada Twitter Menggunakan Naïve Bayes Classifier dengan Seleksi Fitur Chi-Square,” J. Gaussian, vol. 11, no. 4, pp. 580–590, 2023, doi: 10.14710/j.gauss.11.4.580-590.
[8] K. Lemons, “A Comparison Between Naïve Bayes and Random Forest to Predict Breast Cancer,” Int. J. Undergrad. Res. Creat. Act., vol. 12, no. 1, p. Article 10, 2023, doi: 10.7710/2168-0620.0287.
[9] M. J. Hossen, T. T. Ramanathan, and A. Al Mamun, “An Ensemble Feature Selection Approach-Based Machine Learning Classifiers for Prediction of COVID-19 Disease,” Int. J. Telemed. Appl., vol. 2024, no. 1, p. 8188904, 2024, doi: 10.1155/2024/8188904.
[10] H. Irmanda, E. Ermatita, M. K. bin Awang, and M. Adrezo, “Enhancing Weather Prediction Models through the Application of Random Forest Method and Chi-Square Feature Selection,” JOIV Int. J. Informatics Vis., vol. 8, no. 3–2, pp. 1506–1514, 2024, doi: 10.62527/joiv.8.3-2.2356.
[11] P. S. B. Chan and I. A. G. S. Putra, “Deteksi Hate Speech pada Unggahan Media Sosial dengan Naive Bayes Menggunakan Seleksi Fitur Chi-Square,” J. Nas. Teknol. Inf. dan Apl., vol. 3, no. 1, pp. 169–176, 2024, doi: 10.24843/JNATIA.2024.v03.i01.p20.
[12] R. H. Wijaya, G. I. Marthasari, and C. S. K. Aditya, “Perbandingan Feature Selection Chi-Square dan Query Expansion Ranking (QER) pada Analisis Sentimen Terkait Revitalisasi Monas Menggunakan Metode Naïve Bayes Classifier,” J. Repos., vol. 3, no. 4, 2024, doi: 10.22219/repositor.v3i4.31961.
[13] N. L. K. I. Pramesti, M. A. Raharja, N. A. S. ER, and I. G. A. Wibawa, “Analisis Sentimen Ulasan Aplikasi Solusi Kota Cerdas Menggunakan Algoritma Naïve Bayes dan Support Vector Machine (SVM) dengan Seleksi Fitur Chi-Square,” JELIKU J. Elektron. Ilmu Komput. Udayana, vol. 13, no. 1, pp. 65–78, 2024, doi: 10.24843/JLK.2024.v13.i01.p07.
[14] A. Gago, J. M. Aguirre, and L. Wong, “Machine Learning System for the Effective Diagnosis and Survival Prediction of Breast Cancer Patients,” Int. J. Online Biomed. Eng., vol. 20, no. 02, pp. 95–113, 2024, doi: 10.3991/ijoe.v20i02.42883.
[15] A. T. P. Subandono and D. Ariatmanto, “Optimizing Feature Selection in Sentiment Analysis of Bank Saqu: A Comparative Study of SVM and Random Forest using Information Gain and Chi-Square,” Sist. J. Sist. Inf., vol. 14, no. 3, 2025, doi: 10.32520/stmsi.v14i3.5106.
[16] Z. G. Ramadhan, W. M. Ashari, and M. Koprawi, “Perbandingan Kinerja Algoritma Machine Learning Deteksi Malware dengan Z-Score Normalization Hasil Terbaik pada Random Forest,” J. Algoritm., vol. 22, no. 2, pp. 1670–1681, 2025, doi: 10.33364/algoritma/v.22-2.3077.
[17] I. Taufiq, T. A. Y. Siswa, and W. J. Pranoto, “Model Optimasi Random Forest dengan PSO-CHI-SM dalam Mengatasi High Dimensional dan Imbalanced Data Banjir Kota Samarinda,” J. Teknol. Sist. Inf. dan Apl., vol. 7, no. 3, pp. 1267–1279, 2024, doi: 10.32493/jtsi.v7i3.41632.
[18] J. A. Widians, R. Wardoyo, and S. Hartati, “Feature Selection Based on Chi-Square and Ant Colony Optimization for Multi-Label Classification,” Int. J. Electr. Comput. Eng., vol. 14, no. 3, pp. 3303–3312, 2024, doi: 10.11591/ijece.v14i3.pp3303-3312.
[19] I. B. S. Mahendra, T. Widiharih, F. A. Nugroho, and P. S. Sasongko, “Implementation of Feature Selection Chi-Square to Improve the Accuracy of the Classification Model Using the Random Forest Algorithm on Coronary Artery Disease,” J. Appl. Intell. Syst., vol. 9, no. 1, pp. 1–7, 2024, doi: 10.62411/jais.v9i1.7858.
[20] S. Ratnasingam and J. Muñoz-Lopez, “Distance Correlation-Based Feature Selection in Random Forest,” Entropy, vol. 25, no. 9, p. 1250, 2023, doi: 10.3390/e25091250.
[21] S. Xia and Y. Yang, “A Model-Free Feature Selection Technique of Feature Screening and Random Forest-Based Recursive Feature Elimination,” Int. J. Intell. Syst., vol. 2023, pp. 1–16, 2023, doi: 10.1155/2023/2400194.
[22] S. Atik and T. Dalyan, “Feature Selection Optimization with Filtering and Wrapper Methods: Two Disease Classification Cases,” Turkish J. Electr. Eng. Comput. Sci., vol. 31, no. 7, pp. 1329–1342, 2023, doi: 10.55730/1300-0632.4050.
[23] A. Mutiarachim, F. K. Fikriah, B. Ansor, and A. P. Ramdani, “Boosting Performance Classification KNN Customer Loyalty with Chi-Square and Information Gain,” J. Transform., vol. 22, no. 2, pp. 81–89, 2025, doi: 10.26623/6wgy1097.
[24] C. W. Cahyana and A. Nurlayli, “Analisis Performa Logistic Regression, Naïve Bayes, dan Random Forest sebagai Algoritma Pendeteksi Kanker Payudara,” Inser. Inf. Syst. Emerg. Technol. J., vol. 4, no. 1, pp. 51–64, 2023, doi: 10.23887/insert.v4i1.62362.
[25] R. H. Dwinanta and S. E. Wahyuningrum, “The Effect of Chi-Square Feature Selection on the Naive Bayes Algorithm in Analyzing the Sentiment of Gojek Application Reviews on Google Play Store,” Proxies J. Inform., vol. 9, no. 1, pp. 23–29, 2025, doi: 10.24167/proxies.v9i1.13124.
[26] J.-X. Liang, J.-F. Zhao, N. Sun, and B.-J. Shi, “Random Forest Feature Selection and Back Propagation Neural Network to Detect Fire Using Video,” J. Sensors, vol. 2022, no. 4, pp. 1–10, 2022, doi: 10.1155/2022/5160050.
[27] K. Mei, M. Tan, Z. Yang, and S. Shi, “Modeling of Feature Selection Based on Random Forest Algorithm and Pearson Correlation Coefficient,” J. Phys. Conf. Ser., vol. 2219, no. 1, p. 12046, 2022, doi: 10.1088/1742-6596/2219/1/012046.
[28] Z. Zhou, “Research on Feature Selection Techniques in Software Defect Prediction,” Electron. Sci. Technol. Appl., vol. 12, no. 1, 2025, doi: 10.59429/esta.v12i1.9658.
[29] D. Thakur and S. Biswas, “Guided Regularized Random Forest Feature Selection for Smartphone Based Human Activity Recognition,” J. Ambient Intell. Humaniz. Comput., vol. 14, no. 7, pp. 9767–9779, 2022, doi: 10.1007/s12652-022-03862-5.
[30] B. Imran, H. Hambali, A. Subki, Z. Zaeniah, A. Yani, and M. R. Alfian, “Data Mining Using Random Forest, Naïve Bayes, and AdaBoost Models for Prediction and Classification of Benign and Malignant Breast Cancer,” J. Pilar Nusa Mandiri, vol. 18, no. 1, pp. 37–46, 2022, doi: 10.33480/pilar.v18i1.2912.
[31] Mesran, M. Syahrizal, Sarwandi, S. Aripin, D. P. Utomo, and A. Karim, “A comparison of the performance of data mining classification algorithms on medical datasets with the application of data normalization,” 2ND Int. Semin. Sci. Technol., vol. 3048, no. 1, 2024, doi: https://doi.org/10.1063/5.0207994.
[32] M. Syahrizal, S. Aripin, D. P. Utomo, Mesran, Sarwandi, and N. A. Hasibuan, “The application of the K-NN imputation method for handling missing values in a dataset,” 2ND Int. Semin. Sci. Technol., vol. 3048, no. 1, 2024, doi: https://doi.org/10.1063/5.0207998.
[33] D. P. Utomo, Mesran, Sarwandi, S. Aripin, M. Syahrizal, and Pristiwanto, “A comparative analysis of data normalization on data mining classification performance,” 2ND Int. Semin. Sci. Technol., vol. 3048, no. 1, 2024, doi: https://doi.org/10.1063/5.0208001.
Copyright (c) 2026 Dito Putro Utomo, Abdul Karim, Muhammad Syahrizal, Imam Saputra

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.



