Building Energy Consumption Prediction Using Grid Search-Optimized XGBoost: A Comparative Evaluation with Random Forest on Synthetic Data
DOI:
https://doi.org/10.30865/jurikom.v15i5.9980Keywords:
Energy Consumption, Prediction, Machine Learning, XGBoost, Grid SearchAbstract
The rising energy demands of buildings necessitate systems for efficient energy usage. Consequently, accurate prediction methods are required to assist in energy planning, control, and optimization. This study aims to predict energy consumption using the XGBoost algorithm, with parameter optimization performed via Grid Search. Additionally, Random Forest is employed as a benchmark and comparative method, and feature importance analysis is conducted to identify the variables that most significantly influence energy consumption. The dataset used is a synthetic dataset obtained from Kaggle. The dataset simulates environmental conditions and energy use in buildings. The results indicate that the best-performing model is the parameter-optimized XGBoost, which outperformed both Random Forest and the default XGBoost model. Specifically, the optimized XGBoost model achieved an MAE of 4.0029 ± 0.0127, an RMSE of 4.9352 ± 0.0104, and an R² of 0.6026 ± 0.0017. Feature importance analysis identified temperature as the most important feature for predicting energy consumption in the evaluated model. However, because the study is using synthetic data rather than real data from actual building measurements, the findings may not fully represent real-world buildings and should not be directly generalized without further validation. Further evaluation using real-world building energy consumption data is necessary to assess the practical applicability of the approach.
References
[1] R. H. Melo, F. Moko, and S. E. Saleh, “Tantangan Pembangunan Sumberdaya Alam di Indonesia: Dampak Lingkungan dan Ekonomi dalam Pencapaian Keberlanjutan,” J. Penelit. Geogr., vol. 3, no. 2, pp. 149–154, 2024, doi: 10.37905/geojpg.v3i2.29544.
[2] P. Triya, N. Suarna, and N. Dienwati Nuris, “Penerapan Machine Learning Dalam Melakukan Prediksi Harga Saham Pt. Bank Mandiri (Persero) Tbk Dengan Algoritma Linear Regression,” J. Mhs. Tek. Inform., vol. 8, no. 1, pp. 1207–1214, 2024, doi: 10.36040/jati.v8i1.8958.
[3] N. S. Syam et al, “Model Support Vector Machine untuk Prediksi pada Penggunaan Energi Listrik di Rumah Hemat Energi,” J. Inform., vol. 1, no. 2, pp. 56–59, 2022, doi: 10.57094/ji.v1i2.360.
[4] E. P. Febtiawan, L. A. S. I. Akbar, and A. S. Rachman, “Forecasting Produksi Energi Photovoltaic Menggunakan Algoritma Random Forest Classification,” J. Inf. Syst. Res., vol. 5, no. 4, pp. 1053–1062, 2024, doi: 10.47065/josh.v5i4.5514.
[5] M. R. R. Saelan, R. L. Hasanah, and S. Fauziah, “Optimalisasi Prediksi Jarak Tempuh Kendaraan Listrik Menggunakan Xgboost Dan Feature Selection Random Forest,” INTI Nusa Mandiri, vol. 20, no. 2, pp. 213–221, 2026, doi: 10.33480/zahvvq98.
[6] H. Utama and J. D. Santoso, “Pemodelan prediktif konsumsi energi listrik di pabrik baja berbasis XGBoost untuk pengelolaan sumber daya berkelanjutan,” J. Multidisiplin Bahtera, vol. 2, no. 3, pp. 109–118, 2025, doi: 10.24432/C52G8C.
[7] D. T. Murdiansyah, “Prediksi Stroke Menggunakan Extreme Gradient Boosting,” J. Inform. dan Komput., vol. 8, no. 2, p. 419, 2024, doi: 10.26798/jiko.v8i2.1295.
[8] I. Maulita and A. M. Wahid, “Prediksi Magnitudo Gempa Menggunakan Random Forest, Support Vector Regression, XGBoost, LightGBM, dan Multi-Layer Perceptron Berdasarkan Data Kedalaman dan Geolokasi,” J. Pendidik. dan Teknol. Indones., vol. 4, no. 5, pp. 221–232, 2024, doi: 10.52436/1.jpti.470.
[9] M. B. Prayogi, F. Apriani, and Nirma, “Prediksi Angka Harapan Hidup Menggunakan Random Forest dan XGBoost Regression,” J. Inform. dan Teknol., vol. 2, no. 1, pp. 112–121, 2025, doi: 10.30599/ht1k1h53.
[10] Putri. S. K. N. A et al., “Penerapan Hyperparameter Tuning pada Model Klasifikasi untuk Prediksi Risiko Penyakit Jantung : Implementation of Hyperparameter Tuning for Classification Models in Heart Disease Risk Prediction,” MALCOM Indones. J. Mach. Learn. Comput. Sci., no. Vol. 5 No. 4 (2025), pp. 1181–1189, 2025, doi: 10.57152/malcom.v5i4.2138.
[11] M. Y. Shams, A. M. Elshewey, E. S. M. El-kenawy, A. Ibrahim, F. M. Talaat, and Z. Tarek, “Water quality prediction using machine learning models based on grid search method,” Multimed. Tools Appl., vol. 83, no. 12, pp. 35307–35334, 2024, doi: 10.1007/s11042-023-16737-4.
[12] M. H. K. Anam, D. Kurnianingtyas, and A. A. Soebroto, “Implementasi Algoritma Random Forest Untuk Prediksi Churn Pada Pelanggan Retail Online,” J. Pengemb. Teknol. Inf. Dan Ilmu Komput., vol. 10, no. 4, pp. 1–10, 2026.
[13] L. N. Hapsari, D. Ridhwanullah, P. Studi, S. Informasi, and U. T. Serangkai, “Prediksi Kelulusan Siswa Sekolah Menengah Menggunakan XGBoost dan Analisis Feature Importance,” vol. 15, pp. 0–6, 2026.
[14] Mr.Simple, “Energy-consumption-prediction,” Kaggle. Accessed: Jun. 09, 2026. [Online]. Available: https://www.kaggle.com/datasets/mrsimple07/energy-consumption-prediction/data
[15] L. Sari, A. Romadloni, and R. Listyaningrum, “Penerapan Data Mining dalam Analisis Prediksi Kanker Paru Menggunakan Algoritma Random Forest,” Infotekmesin, vol. 14, no. 1, pp. 155–162, 2023, doi: 10.35970/infotekmesin.v14i1.1751.
[16] H. Rathore, H. K. Meena, and P. Jain, “Prediction of EV Energy consumption Using Random Forest And XGBoost,” Proc. - 2nd Int. Conf. Power Electron. Energy, ICPEE 2023, pp. 1–6, 2023, doi: 10.1109/ICPEE54198.2023.10060798.
[17] H. Abbasimehr, R. Paki, and A. Bahrini, “A novel XGBoost-based featurization approach to forecast renewable energy consumption with deep learning models,” Sustain. Comput. Informatics Syst., vol. 38, no. November 2022, p. 100863, 2023, doi: 10.1016/j.suscom.2023.100863.
[18] S. L. Sari and B. Rahmat, “Penerapan Algoritma Grid Search Untuk Memprediksi Customer Churn Pada Bank Menggunakan Perbandingan Optimasi Decision Tree Dan Random Forest,” J. Mhs. Tek. Inform., vol. 10, no. 1, pp. 908–913, 2026, doi: 10.36040/jati.v10i1.16819.
[19] S. W. Iriananda, R. W. Budiawan, A. Y. Rahman, and I. Istiadi, “Optimasi Klasifikasi Sentimen Komentar Pengguna Game Bergerak Menggunakan Svm, Grid Search Dan Kombinasi N-Gram,” J. Teknol. Inf. dan Ilmu Komput., vol. 11, no. 4, pp. 743–752, 2024, doi: 10.25126/jtiik.1148244.
[20] I. J. Matondang, E. Budianita, F. Syafria, and I. Afrianty, “Sistem Prediksi Produksi Kelapa Sawit Berbasis Gradio Menggunakan Algoritma Regresi Linear Berganda,” Bull. Comput. Sci. Res., vol. 6, no. 2, pp. 664–672, 2026, doi: 10.47065/bulletincsr.v6i2.994.
[21] M. R. R. Saelan, R. L. Hasanah, and S. Fauziah, “Optimalisasi Prediksi Jarak Tempuh Kendaraan Listrik Menggunakan Xgboost Dan Feature Selection Random Forest,” LPPM Nusa Mandiri, vol. 19, no. 2, pp. 146–153, 2025, doi: inti.v20i2.7828.
[22] J. Gao, “R-Squared (R2):-How much variation is explained?,” Res. Methods Med. Heal. Sci., vol. 5, no. 4, pp. 104–109, 2024, doi: 10.1177/26320843231186398.



