Evaluasi Kinerja Algoritma Random Forest dan KNN untuk Prediksi Cuaca di Jakarta

Authors

  • Nurdin Wibowo Universitas Negeri Semarang
  • Wahyu Hardyanto Teknik Elektro Universitas Negeri Semarang
  • Alpon Sepriando Badan Meteorologi Klimatologi dan Geofisika (BMKG)
  • Djuniadi Universitas Negeri Semarang
  • Tri Nurmayati Badan Meteorologi Klimatologi dan Geofisika (BMKG)
  • Fakhrul Alam Badan Meteorologi Klimatologi dan Geofisika (BMKG)

DOI:

https://doi.org/10.31539/wzj0r898

Abstract

This study aims to compare the performance of Random Forest and K-Nearest Neighbors (KNN) algorithms in classifying daily weather categories at Kemayoran Meteorological Station, Jakarta. The data used were BMKG observation data from 2017 to 2023, with classification targets consisting of No Significant Weather, RA, TS, and TS,RA. The variables included temperature, rainfall, air pressure, humidity, wind speed, sunshine duration, wind direction, and month. The data were preprocessed and divided into training and testing sets using an 80:20 ratio. The results showed that Random Forest achieved an accuracy of 78% with a weighted average F1-score of 0.75, while KNN achieved an accuracy of 65% with a weighted average F1-score of 0.59. Random Forest performed better in classifying dominant weather categories, although both algorithms still had limitations in identifying minority categories, particularly TS. These findings indicate that Random Forest is more suitable for daily weather classification based on BMKG observation data in urban areas.

 

Keywords: K-Nearest Neighbors; Random Forest; Weather Classification

Author Biographies

  • Wahyu Hardyanto, Teknik Elektro Universitas Negeri Semarang

    Dosen Universitas Negeri semarang

  • Alpon Sepriando, Badan Meteorologi Klimatologi dan Geofisika (BMKG)

    Badan Meteorologi Klimatologi dan Geofisika

  • Djuniadi, Universitas Negeri Semarang

    Dosen Universitas Negeri Semarang

  • Tri Nurmayati, Badan Meteorologi Klimatologi dan Geofisika (BMKG)

    Badan Meteorologi Klimatologi dan Geofisika (BMKG)

  • Fakhrul Alam, Badan Meteorologi Klimatologi dan Geofisika (BMKG)

    Badan Meteorologi Klimatologi dan Geofisika (BMKG)

References

Abdul Raheem, M., Awotunde, J. B., Adeniyi, A. E., Oladipo, I. D., & Adekola, S. O. (2022). Weather Prediction Performance Evaluation on Selected Machine Learning Algorithms. IAES International Journal of Artificial Intelligence, 11(4), 1535–1544. https://doi.org/10.11591/ijai.v11.i4.pp1535-1544

Bochenek, B., & Ustrnul, Z. (2022). Machine Learning in Weather Prediction and Climate Analyses—Applications and Perspectives. Atmosphere, 13(2), 180. https://doi.org/10.3390/atmos13020180

Darmawan, Z. M. E., Dianta, A. F., Fathoni, K., Rachmawati, O. C. R., & Apriandy, K. I. (2025). Comparison of Machine Learning Classification Methods for Weather Prediction: A Performance Analysis. G-Tech: Jurnal Teknologi Terapan, 9(2), 715–727. https://doi.org/10.70609/gtech.v9i2.6649

Dwiyanti, Z. A., & Prianto, C. (2023). Prediksi Cuaca Kota Jakarta Menggunakan Metode Random Forest. Jurnal Tekno Insentif, 17(2), 127–137. https://doi.org/10.36787/jti.v17i2.1136

Fowdur, T. P., & Nazir, R. M. N. U. D. I. (2022). A Real-Time Collaborative Machine Learning Based Weather Forecasting System with Multiple Predictor Locations. Array, 14, 100153. https://doi.org/10.1016/j.array.2022.100153

Hamami, F., & Dahlan, I. A. (2022). Klasifikasi Cuaca Provinsi DKI Jakarta Menggunakan Algoritma Random Forest dengan Teknik Oversampling. Jurnal Teknoinfo, 16(1), 87–92. https://doi.org/10.33365/jti.v16i1.1533

Kareem, F. Q., Abdulazeez, A. M., & Hasan, D. A. (2021). Predicting Weather Forecasting State Based on Data Mining Classification Algorithms. Asian Journal of Research in Computer Science, 9(3), 13–24. https://doi.org/10.9734/ajrcos/2021/v9i330222

Kim, B. Y., Cha, J. W., Chang, K. H., & Lee, C. (2021). Visibility Prediction Over South Korea Based on Random Forest. Atmosphere, 12(5), 552. https://doi.org/10.3390/atmos12050552

Meenal, R., Michael, P. A., Pamela, D., & Rajasekaran, E. (2021). Weather Prediction Using Random Forest Machine Learning Model. Indonesian Journal of Electrical Engineering and Computer Science, 22(2), 1208–1215. https://doi.org/10.11591/ijeecs.v22.i2.pp1208-1215

Meenal, R., Kailash, K., Michael, P. A., Joseph, J. J., Josh, F. T., & Rajasekaran, E. (2022). Machine Learning Based Smart Weather Prediction. Indonesian Journal of Electrical Engineering and Computer Science, 28(1), 508–515. https://doi.org/10.11591/ijeecs.v28.i1.pp508-515

Nasution, B. I., Saputra, F. M., Kurniawan, R., Ridwan, A. N., Fudholi, A., & Sumargo, B. (2022). Urban Vulnerability to Floods Investigation in Jakarta, Indonesia: A Hybrid Optimized Fuzzy Spatial Clustering and News Media Analysis Approach. International Journal of Disaster Risk Reduction, 83, 103407. https://doi.org/10.1016/j.ijdrr.2022.103407

Priyambodoho, B. A., Kure, S., Januriyadi, N. F., Farid, M., Varquez, A. C. G., Kanda, M., & Kazama, S. (2022). Effects of Urban Development on Regional Climate Change and Flood Inundation in Jakarta, Indonesia. Journal of Disaster Research, 17(4), 516–525. https://doi.org/10.20965/jdr.2022.p0516

Putra, A. F. D., Azmi, M. N., Wijayanto, H., Utama, S., & Wirawan, I. G. P. W. W. (2024). Optimizing Rain Prediction Model Using Random Forest and Grid Search Cross-Validation for Agriculture Sector. MATRIK: Jurnal Manajemen, Teknik Informatika dan Rekayasa Komputer, 23(3), 519–530. https://doi.org/10.30812/matrik.v23i3.3891

Putri, A. D. P., Al Haris, M., Fauzi, F., & Amri, S. (2025). K-Nearest Neighbor (KNN) Method For Weather Data Prediction: Penerapan metode K-Nearest Neighbour (KNN) untuk prediksi data cuaca. Journal of Data Insights, 3(1), 56–64. https://doi.org/10.26714/jodi.v3i1.214

Rakhmat, G. A., & Mutohar, W. (2023). Prakiraan hujan Menggunakan Metode Random Forest dan Cross Validation. MIND Journal, 8(2), 173–187. https://doi.org/10.26760/mindjournal.v8i2.173-187

Safia, M., Shahid, M., & Qureshi, M. A. (2023). Classification of Weather Conditions Based on Supervised Learning for Swedish Cities. Atmosphere, 14(7), 1174. https://doi.org/10.3390/atmos14071174

Shaiba, H., Marzouk, R., Nour, M. K., Negm, N., Hilal, A. M., Mohamed, A., Motwakel, A., Yaseen, I., Zamani, A. S., & Rizwanullah, M. (2022). Weather Forecasting Prediction Using Ensemble Machine Learning for Big Data Applications. Computers, Materials & Continua, 73(2), 3367–3382. https://doi.org/10.32604/cmc.2022.030067

Yuda, A. S. A., Rosady, M. D. A., Faisal, N. I., & Ismanto, E. (2025). Performance analysis of K-Nearest Neighbors (KNN) and Random Forest Algorithms for Classification of Weather Conditions. Jurnal CoSciTech (Computer Science and Information Technology), 6(2), 337–343. https://doi.org/10.37859/coscitech.v6i2.9827

Zhang, H., Liu, Y., Zhang, C., & Li, N. (2025). Machine Learning Methods for Weather Forecasting: A survey. Atmosphere, 16(1), 82. https://doi.org/10.3390/atmos16010082

Downloads

Published

2026-06-30