Klasifikasi Berita Hoaks Berbahasa Indonesia Menggunakan TF-IDF dengan Jumlah Fitur Tinggi dan Algoritma K-Nearest Neighbors sebagai Model Baseline

Authors

  • Moh. Dimas Ubaidillah Universitas Trunojoyo Madura
  • Ahmad Yusril Ihsan Sya’bana Universitas Trunojoyo Madura
  • Laili Cahyani Universitas Trunojoyo Madura

DOI:

https://doi.org/10.24252/shift.v6i1.251

Keywords:

TF-IDF, KNN, Fake News, Text Mining, News Classification

Abstract

This study aims to develop an automatic classification model to distinguish fake news and valid news in Indonesian-language texts using the Term Frequency–Inverse Document Frequency (TF-IDF) method and the K-Nearest Neighbors (KNN) algorithm. This research is positioned as a baseline study to evaluate the effectiveness of using TF-IDF representations with a relatively large number of features in the KNN algorithm, as studies that specifically address this aspect in Indonesian fake news classification remain limited. The dataset consists of 500 news documents that undergo preprocessing stages, including text cleaning, character normalization, punctuation removal, and stopword elimination. Numerical document representations are generated using TF-IDF with a maximum of 5,000 features. The dataset is then divided into 400 training samples and 100 testing samples before training the KNN model using standard parameters. The evaluation results show that the proposed model achieves an accuracy of 78%, with balanced precision, recall, and f1-score across both classes. The confusion matrix indicates that most documents are correctly classified, although some misclassifications still occur due to lexical and structural similarities between fake news and valid news texts. In the context of fake news detection, this level of accuracy is considered sufficiently effective as an early detection support system, as the model is able to limit False Negative errors to a relatively low level, allowing the majority of fake news to be successfully identified. These findings demonstrate that the combination of TF-IDF and KNN represents a simple, efficient, and viable baseline approach for developing Indonesian fake news detection systems.

Downloads

Download data is not yet available.

References

[1] M. D. Desriansyah, I. U. Sari, and Z. Zulfahmi, “Analisis Efektivitas Algoritma Machine Learning dalam Deteksi Hoaks: Pada Berita Digital Berbahasa Indonesia,” JISKA, vol. 3, no. 2, pp. 63–69, Jun. 2025, doi: 10.47233/jiska.v3i1.2024.

[2] C. D. Manning, P. Raghavan, and H. Schütze, Introduction to Information Retrieval. New York, NY, USA: Cambridge University Press, 2008.

[3] P. K. Syriopoulos, N. G. Kalampalikis, S. B. Kotsiantis, and M. N. Vrahatis, “kNN classifica-tion: A review,” Ann. Math. Artif. Intell., vol. 93, no. 1, pp. 43–75, Feb. 2025, doi: 10.1007/s10472-023-09882-x.

[4] G. Salton and C. Buckley, “Term-weighting approaches in automatic text retrieval,” Inf. Process. Manage., vol. 24, no. 5, pp. 513–523, 1988, doi: 10.1016/0306-4573(88)90021-0.

[5] M. Bounabi, K. El Moutaouakil, and K. Satori, “Text classification using fuzzy TF-IDF and machine learning models,” in Proc. 4th Int. Conf. Big Data and Internet of Things (BDI-oT’19), Rabat, Morocco, Oct. 2019, pp. 1–6, doi: 10.1145/3372938.3372956.

[6] R. R. Sani, Y. A. Pratiwi, S. Winarno, E. D. Udayanti, and F. Alzami, “Analisis Perbandingan Algoritma Naive Bayes Classifier dan Support Vector Machine untuk Klasifikasi Berita Hoax pada Berita Online Indonesia,” Jurnal Masyarakat Informatika (JMASIF), vol. 13, no. 2, pp. 85–98, Nov. 2022, doi: 10.14710/jmasif.13.2.47983.

[7] M. D. Hendriyanto and B. N. Sari, “Penerapan Algoritma K-Nearest Neighbor dalam Klasifi-kasi Judul Berita Hoax,” Jurnal Ilmiah Informatika (JIF), vol. 10, no. 02, pp. 80–84, Sep. 2022, doi: 10.33884/jif.v10i02.5477.

[8] D. A. Nur’Faradila, L. Magdalena, and M. Febima, ‘Penerapan Naïve Bayes Classifier Untuk Klasifikasi Postingan Berita Hoaks Di Instagram Cirebon Saber Hoaks’, MJI, vol. 16, no. 2, p. 243, Dec. 2024, doi: 10.35194/mji.v16i2.4616.

[9] B. Christopher, F. Arisandy, and M. I. Fahmi, “Analisis Komparasi Metode K-Nearest Neigh-bor dan Naïve Bayes Classifier Berbasis Optimasi Randomized Search dalam Klasifikasi Beri-ta Hoaks,” JATISI (Jurnal Teknik Informatika dan Sistem Informasi), vol. 12, no. 2, pp. 272–283, Jun. 2025, doi: 10.35957/jatisi.v12i2.11371.

[10] A. T. Saputra, Y. A. Mustofa, Y. Lasena, and I. S. K. Idris, “Klasifikasi Berita Online pada Lipu-tan 6 Menggunakan Metode KNN,” Jurnal Ilmiah Ilmu Komputer Banthayo Lo Komputer, vol. 4, no. 1, pp. 58–66, 2025.

[11] W. McKinney, “Data structures for statistical computing in Python,” in Proc. 9th Python in Science Conf. (SciPy 2010), Austin, TX, USA, 2010, pp. 56–61, doi: 10.25080/Majora-92bf1922-00a.

[12] S. Bird, E. Klein, and E. Loper, Natural Language Processing with Python. Sebastopol, CA, USA: O’Reilly Media, 2009.

[13] S. Sarica and J. Luo, “Stopwords in technical language processing,” PLoS ONE, vol. 16, no. 8, p. e0254937, Aug. 2021, doi: 10.1371/journal.pone.0254937.

[14] R. Wati, S. Ernawati, and H. Rachmi, “Pembobotan TF-IDF Menggunakan Naïve Bayes pada Sentimen Masyarakat Mengenai Isu Kenaikan BIPIH,” Jurnal Manajemen Informatika (JAMIKA), vol. 13, no. 1, pp. 84–93, 2023, doi: 10.34010/jamika.v13i1.9424.

[15] F. Pedregosa et al., “Scikit-learn: Machine learning in Python,” J. Mach. Learn. Res., vol. 12, pp. 2825–2830, 2011.

[16] D. Setiawan, A. Muhammad, and A. Firizkiansah, “Pengklasifikasian Dokumen Teks Bahasa Indonesia berbasis Vektor Space Model dengan Menggunakan Metode k-Nearest Neighbor (k-NN) dan Euclidean Distance,” JIKOMTI: Jurnal Ilmiah Ilmu Komputer dan Teknologi In-formasi, vol. 1, no. 1, pp. 30–37, Dec. 2024.

[17] M. Sokolova and G. Lapalme, “A systematic analysis of performance measures for classifi-cation tasks,” Inf. Process. Manage., vol. 45, no. 4, pp. 427–437, 2009, doi: 10.1016/j.ipm.2009.03.002.

Downloads

Published

01/30/2026

How to Cite

[1]
M. D. Ubaidillah, A. Y. Ihsan Sya’bana, and L. Cahyani, “Klasifikasi Berita Hoaks Berbahasa Indonesia Menggunakan TF-IDF dengan Jumlah Fitur Tinggi dan Algoritma K-Nearest Neighbors sebagai Model Baseline”, Journal Software, Hardware and Information Technology (SHIFT), vol. 6, no. 1, pp. 69–79, Jan. 2026, doi: 10.24252/shift.v6i1.251.