Optimization of the Random Forest Algorithm Using GridSearchCV for Household Energy Consumption Classification

Authors

  • Adinda Nabila STIKOM Tunas Bangsa
  • Azharda Afriaci STIKOM Tunas Bangsa
  • Haya Atika Syafi'ah STIKOM Tunas Bangsa

DOI:

https://doi.org/10.55123/jomlai.v5i2.8571

Keywords:

Smart Home, Energy Efficiency, Random Forest, GridSearchCV, Classification

Abstract

The high fluctuation in electricity usage and the complexity of historical data distribution in Internet of Things (IoT)-based smart home environments frequently trigger significant uncertainty in household energy efficiency management. Without an intelligent predictive system, energy consumption surges become exceedingly difficult to control accurately. Therefore, this study aims to develop a high-accuracy predictive classification model architecture to map energy consumption levels into three main categories (Low, Medium, High) by leveraging the Random Forest algorithm. The experimental process was conducted systematically, beginning with the evaluation of a baseline model, followed by an optimization phase integrating the GridSearchCV method based on 5-fold cross-validation for exhaustive hyperparameter tuning on the IoT Smarthome Energy Dataset. Performance was comprehensively evaluated using a confusion matrix and gap accuracy analysis to ensure model robustness. Experimental results proved that the hyperparameter optimization process successfully boosted the global accuracy rate significantly from an initial baseline of 98.92% to 99.46%, while effectively reducing the number of misclassifications. Furthermore, the feature importance analysis provided a transparent scientific interpretation, where the future_consumption_kWh feature was identified as having the most dominant influence at 61.75% on the model's decision structure. In conclusion, this optimized Random Forest architecture is proven to be highly robust and ready to be implemented as a real-scale automatic energy-saving instrument.

References

[1] W. Agustiarmi et al., “Real-Time IoT-based Energy Power Consumption Monitoring System for Smart Homes,” Int. J. Adv. Sci. Eng. Inf. Technol., vol. 15, no. 5, pp. 1407–1412, 2025, doi: 10.18517/ijaseit.15.5.20918.

[2] T. Wang, Q. Zhao, W. Gao, and X. He, “Research on energy consumption in household sector: a comprehensive review based on bibliometric analysis,” Front. Energy Res., vol. 11, no. January, pp. 1–22, 2023, doi: 10.3389/fenrg.2023.1209290.

[3] Regina Citra Kurnia Pangestu and Anak Agung Ketut Ayuningsasi, “Pengaruh Konsumsi Energi Sektor Industri, Rumah Tangga, dan Transportasi terhadap Emisi Karbon di Indonesia,” Inisiatif: Jurnal Ekonomi, Akuntansi dan Manajemen, vol. 3, no. 4, pp. 297–311, 2024, doi: 10.30640/inisiatif.v3i4.3154.

[4] D. B. Noya, O. Wullur, O. Teng, Z. Sukarame, F. Aguw, and M. Rantung, “The Influence of Using Electronic Devices in the Household,” Jurnal Syntax Admiration, vol. 6, no. 2, pp. 1359–1366, 2025, doi: 10.46799/jsa.v6i2.2138.

[5] A. R. Rudiyanto, B. P. Satria, and H. D. Panjaitan, “Optimization of Smart Home Energy Consumption Using Machine Learning-Based Load Forecasting,” Journal of Technology Informatics and Engineering, vol. 4, no. 2, pp. 300–316, 2025, doi: 10.51903/jtie.v4i2.437.

[6] M. Casanova and J. Moloney, “Electricity 2025: Analysis and forecast to 2027,” 2025. [Online]. Available: www.iea.org

[7] P. Y. Muslim et al., “Tangga Berbasis Iot Iot-Based Household Electricity Consumption Monitoring System,” Jurnal Ilmiah Teknologi Informasi dan Komunikasi, vol. 18, no. 2, pp. 1–7, 2025, [Online]. Available: https://www.iea.org/reports/electricity-2025

[8] A. P. Wijaya, M. S. Said, and A. M. Islah, “Pengembangan Sistem Pemantauan Pemakaian Listrik Rumah Berbasis Internet of Things,” Simtek : jurnal sistem informasi dan teknik komputer, vol. 10, no. 2, pp. 475–479, 2025, doi: 10.51876/simtek.v10i2.1676.

[9] W. Jia and S. Wu, “Spatial Differences and Influencing Factors of Energy Poverty: Evidence From Provinces in China,” Front. Environ. Sci., vol. 10, no. June, pp. 1–16, 2022, doi: 10.3389/fenvs.2022.921374.

[10] S. Su et al., “Temporal dynamic assessment of household energy consumption and carbon emissions in China: From the perspective of occupants,” Sustain. Prod. Consum., vol. 37, pp. 142–155, 2023, doi: https://doi.org/10.1016/j.spc.2023.02.014.

[11] J. Zheng, Y. Dang, and U. Assad, “Household energy consumption, energy efficiency, and household income–Evidence from China,” Appl. Energy, vol. 353, p. 122074, 2024, doi: https://doi.org/10.1016/j.apenergy.2023.122074.

[12] I. Valentine, J. Triloka, and R. Sholehurrohman, “Application of Support Vector Machine Algorithm for Energy Consumption Prediction,” Journal of Applied Informatics and Computing, vol. 10, no. 2, pp. 1598–1605, 2026, doi: 10.30871/jaic.v10i2.11713.

[13] U. Maltuf and Z. Fatah, “Penerapan Algoritma Decision Tree Untuk Klasifikasi Konsumsi Energi Listrik Rumah Tangga Dengan Penggunaan Rapid Miner,” Jurnal Ilmiah Multidisiplin Ilmu, vol. 1, no. 1, pp. 38–45, 2025, doi: https://doi.org/10.69714/0hmk8712.

[14] A. Olivia and A. Jaenul, “Smart Home Electricity Meter Based on IoT with Bill Prediction Using Random Forest Algorithm,” Journal of Applied Information and Comunication Technologi, vol. 12, no. 1, pp. 78–81, 2026, doi: https://doi.org/10.32497/jaict.v12i1.

[15] N. Bhardwaj and P. Joshi, “Adaptive Energy Management for MATTER-Enabled Smart Homes,” IEEE Access, vol. 13, no. June, pp. 113773–113786, 2025, doi: 10.1109/ACCESS.2025.3584381.

[16] M. K. Saravana, M. S. Roopa, J. S. Arunalatha, and K. R. Venugopal, “Transformers for Multivariate Time Series Forecasting: Comprehensive Analysis, Challenges, Research Opportunities and Future Prospects,” IEEE Access, 2026, doi: 10.1109/ACCESS.2026.3654408.

[17] A. A. Alsumaiei, “Complexity-efficiency dynamics of metaheuristic-optimized recurrent neural network models for drought forecasting in hyper-arid Kuwait,” J. Hydrol. Reg. Stud., vol. 64, Apr. 2026, doi: 10.1016/j.ejrh.2026.103300.

[18] P. W. Adi, A. Sugiharto, S. Adhy, E. Vianita, and G. Rahman, “Improving balance in intrusion detection for IoT networks using multicollinearity and discriminative power-based feature selection,” Discover Internet of Things, Jun. 2026, doi: 10.1007/s43926-026-00402-x.

[19] D. Romaissa Beddiar et al., “Efficient Edge AI Inference: A Literature Review,” 2026. doi: http://dx.doi.org/10.2139/ssrn.6359018.

[20] A. N. S. Kinasih, A. N. Handayani, J. T. Ardiansah, and N. S. Damanhuri, “Comparative analysis of decision tree and random forest classifiers for structured data classification in machine learning,” Science in Information Technology Letters, vol. 5, no. 2, pp. 13–24, 2024, doi: 10.31763/sitech.v5i2.1746.

[21] D. Ljunggren and S. Ishii, “A Comparative Analysis of the Robustness to Noise of Machine Learning Classifiers,” Communications in Computer and Information Science, vol. 2413 CCIS, pp. 182–192, 2025, doi: 10.1007/978-3-031-87511-3_13.

[22] M. Imani, A. Beikmohammadi, and H. R. Arabnia, “Comprehensive Analysis of Random Forest and XGBoost Performance with SMOTE, ADASYN, and GNUS Under Varying Imbalance Levels,” Technologies (Basel)., vol. 13, no. 3, pp. 1–40, 2025, doi: 10.3390/technologies13030088.

[23] H. Putra and R. Rumini, “Comparative Study of Logistic Regression, Random Forest, and XGBoost for Bank Loan Approval Classification,” Journal of Applied Informatics and Computing, vol. 9, no. 5, pp. 2822–2835, 2025, doi: 10.30871/jaic.v9i5.10862.

[24] M. W. Nugroho, “Analisis Performa Algoritma Random Forest dalam Mengatasi Overfitting pada Model Prediksi,” Jurnal JTIK (Jurnal Teknologi Informasi dan Komunikasi), vol. 9, no. 4, pp. 1562–1571, 2025, doi: 10.35870/jtik.v9i4.4236.

[25] Y. Zhao, W. Zhang, and X. Liu, “Grid search with a weighted error function: Hyper-parameter optimization for financial time series forecasting,” Appl. Soft Comput., vol. 154, no. August 2023, p. 111362, 2024, doi: 10.1016/j.asoc.2024.111362.

[26] D. M. Belete and M. D. Huchaiah, “Grid search in hyperparameter optimization of machine learning models for prediction of HIV/AIDS test results,” International Journal of Computers and Applications, vol. 44, no. 9, pp. 875–886, 2022, doi: 10.1080/1206212X.2021.1974663.

[27] C. Azzaria, E. Daniati, and A. Ristyawan, “Peningkatan Akurasi Deteksi Liver Disease melalui Hyperparameter Tuning pada Algoritma Random Forest,” The Indonesian Journal of Computer Science Research, vol. 4, no. 2, pp. 139–147, 2025, [Online]. Available: https://subset.id/index.php/IJCSR

[28] G. B. Anugrah and T. Arifin, “Optimasi Support Vector Machine Menggunakan Seleksi Fitur Random Forest Dan Hyperparameter Gridsearchcv Untuk Klasifikasi Raisin Dataset,” Djtechno: Jurnal Teknologi Informasi, vol. 6, no. 2, pp. 527–540, 2025, doi: 10.46576/djtechno.v6i2.7008.

[29] W. Nugraha and A. Sasongko, “Hyperparameter Tuning on Classification Algorithm with Grid Search,” Sistemasi, vol. 11, no. 2, p. 391, 2022, doi: 10.32520/stmsi.v11i2.1750.

[30] Ziya, “IoT-SmartHome Energy Dataset,” Kaggle. [Online]. Available: IoT-SmartHome Energy Dataset

[31] L. Ma, M. S. Ghouri, M. Altaf, M. Zheng, and L. Wang, “Explainable machine learning for predicting building energy performance and sustainability certification in construction megaprojects,” Energy Build., vol. 367, p. 117774, Sep. 2026, doi: 10.1016/J.ENBUILD.2026.117774.

Downloads

Published

2026-06-15

How to Cite

Adinda Nabila, Azharda Afriaci, & Haya Atika Syafi'ah. (2026). Optimization of the Random Forest Algorithm Using GridSearchCV for Household Energy Consumption Classification. JOMLAI: Journal of Machine Learning and Artificial Intelligence, 5(2), 74–88. https://doi.org/10.55123/jomlai.v5i2.8571

Issue

Section

Articles