Air temperature is an important element in meteorology that directly impacts community activities and urban environments. Daily fluctuations of air temperature in tropical urban areas such as Makassar are influenced by local weather factors and the Urban Heat Island phenomenon, making accurate forecasting crucial for supporting adaptation to extreme temperatures. This study develops and combines the Particle Swarm Optimization and Random Forest algorithms to predict daily air temperatures in Makassar. PSO was selected based on its ability to optimize machine learning models such as RF, which is highly dependent on its hyperparameter configuration. The data used were sourced from the NASA POWER portal for the 1984–2026 period, comprising 15,608 rows of daily observations with seven meteorological variables. The PSO optimization process with 15 particles reached convergence at the 8th iteration and yielded the optimal hyperparameter combination: n_estimators = 166, max_depth = 20, min_samples_split = 2, and min_samples_leaf = 1. The 80:20 data split scenario yielded the best results, with an MSE of 0.0203, an MAE of 0.0891, an R² of 0.9700, and a MAPE of 0.3180%. The previous day’s temperature feature (T2M_lag1) was the most significant feature, with an importance value of 79%. Overall, the PSO-RF model can be used as an alternative approach for modeling and monitoring daily air temperature in the city of Makassar.
Copyrights © 2026