Jurnal Computer Science and Information Technology (CoSciTech)
Vol 6 No 2 (2025): Jurnal Computer Science and Information Technology (CoSciTech)

Analisis Kinerja Algoritma K-Nearest Neighbors (KNN) dan Random Forest untuk Klasifikasi Kondisi Cuaca

Asha Yuda, Agim Sahrija (Unknown)
Muhammad Desfriyan Arif Rosady (Unknown)
Nabil Ibrahim Faisal (Unknown)
Edi Ismanto (Unknown)



Article Info

Publish Date
19 Sep 2025

Abstract

The development of information technology has encouraged the use of machine learning algorithms in various fields, including in the analysis and prediction of weather conditions. This study aims to analyze and compare the performance of two machine learning algorithms, namely K-Nearest Neighbors (KNN) and Random Forest, in the classification of weather conditions based on historical meteorological data. The dataset used includes features such as rainfall, maximum temperature, minimum temperature, and wind speed, with target categories in the form of weather types such as rain, sunny, fog, drizzle, and snow. The process includes data pre-processing, feature scaling, training and test data sharing, and model training using the scikit-learn library. Performance evaluations are conducted using accuracy, precision, recall, and F1-score metrics. The results showed that the Random Forest model had higher accuracy (82%) than KNN (78%), with more stable performance in the majority class. However, both models experienced significant performance declines in minority classes due to data imbalances. The study recommends further optimizations such as class balancing and model parameter selection to improve the overall accuracy of weather classification.

Copyrights © 2025






Journal Info

Abbrev

coscitech

Publisher

Subject

Computer Science & IT

Description

Jurnal CoSciTech (Computer Science and Information Technology) merupakan jurnal peer-review yang diterbitkan oleh Program Studi Teknik Informatika, Fakultas Ilmu Komputer, Univeritas Muhammadiyah Riau (UMRI) sejak April tahun 2020. Jurnal CoSciTech terdaftar pada PDII LIPI dengan Nomor ISSN ...