Optimizing electric vehicle energy consumption prediction through machine learning and ensemble approaches
- PMID: 40781262
- PMCID: PMC12334666
- DOI: 10.1038/s41598-025-14129-2
Optimizing electric vehicle energy consumption prediction through machine learning and ensemble approaches
Abstract
Accurately predicting energy consumption in electric vehicles (EVs) is essential for enhancing energy efficiency and improving infrastructure planning. However, this task remains challenging due to the complex interplay of driving conditions, vehicle specifications, and environmental factors. This study proposes a novel data-driven approach that utilizes machine learning (ML) techniques, supported by an extensive real-world dataset derived from Colorado. The research aims to extract meaningful insights from the data using advanced analytical methodologies. This research makes three key advances: (1) systematic comparison of four hyperparameter optimization methods (GridSearchCV, RandomizedSearchCV, Optuna, PSO) for KNN regression, (2) development of a stacking hybrid ensemble combining KNN with tree-based models, and (3) comprehensive validation on real-world data with novel temporal feature engineering. The K-Nearest Neighbors (KNN) algorithm is employed as the base model, with hyperparameter optimization performed using GridSearchCV, RandomizedSearchCV, Optuna, and Particle Swarm Optimization (PSO). Additionally, a stacking hybrid ensemble model is developed to combine the strengths of multiple base models. The results show that the stacking hybrid ensemble model achieves the best performance, with the lowest prediction errors (MAE = 0.645880, RMSE = 1.788540) and the highest accuracy score R² (0.960078). Among the optimization techniques, Optuna proves to be the most effective for tuning the KNN model. This study emphasizes the capabilities of ensemble learning and advanced optimization methods in enhancing the prediction of energy consumption. These results demonstrate that temporal feature extraction and optimized ensemble modeling significantly enhance prediction accuracy, providing EV manufacturers and policymakers with deployable tools for sustainable energy management.
Keywords: Electric vehicles; Energy consumption prediction; Ensemble hybrid models; Hyperparameter tuning; KNN.
© 2025. The Author(s).
Conflict of interest statement
Declarations. Competing interests: The authors declare no competing interests. Consent for publication: The authors have full consent for publication. Software and packages used: The SciPy package in Python is used for statistical techniques, including hypothesis testing, probability distributions, and correlation analysis. Additionally, statistical modelling, data analysis, and manipulation, as well as handling dates and times, are accomplished using the statsmodels, NumPy, and pandas packages, along with the DateTime package in Python. This comprehensive data preprocessing and model implementation is conducted using VS Code software.
Figures









Similar articles
-
Application of supervised machine learning and unsupervised data compression models for pore pressure prediction employing drilling, petrophysical, and well log data.Sci Rep. 2025 Jul 9;15(1):24706. doi: 10.1038/s41598-025-89199-3. Sci Rep. 2025. PMID: 40634540 Free PMC article.
-
Enhanced wind power forecasting using machine learning, deep learning models and ensemble integration.Sci Rep. 2025 Jul 1;15(1):20572. doi: 10.1038/s41598-025-05250-3. Sci Rep. 2025. PMID: 40596009 Free PMC article.
-
From pixels to prognosis: leveraging radiomics and machine learning to predict IDH1 genotype in gliomas.Neurosurg Rev. 2025 Apr 29;48(1):396. doi: 10.1007/s10143-025-03515-z. Neurosurg Rev. 2025. PMID: 40299088 Free PMC article.
-
Approaches for predicting dairy cattle methane emissions: from traditional methods to machine learning.J Anim Sci. 2024 Jan 3;102:skae219. doi: 10.1093/jas/skae219. J Anim Sci. 2024. PMID: 39123286 Free PMC article.
-
The Use of Machine Learning for Analyzing Real-World Data in Disease Prediction and Management: Systematic Review.JMIR Med Inform. 2025 Jun 19;13:e68898. doi: 10.2196/68898. JMIR Med Inform. 2025. PMID: 40537090 Free PMC article.
References
-
- Lakshmipriya, N., Ayyappan, S. & Gokul, C. Sustainable charging infrastructure for electric vehicles: Harnessing solar and wind energy. Eng. Headw.16, 57–68 (2025).
-
- Dluhopolskyi, O., Kolinets, L., Ivashuk, Y., Lotysh, O. & Sovira, Y. Development of the electric vehicle market with a focus on sustainability. Socio-economic Relations Digit. Soc.4 (54), 5–15 (2024).
-
- Ahmadi, S., Tack, G., Harabor, D., Kilby, P. & Jalili, M. T energy-optimal path planning for electric vehicles. Preprint at https://arXiv.org/abs/2411.12964. (2024).
-
- Zubair, M., Chen, S., Ma, Y., Ping Ong, G. & Pang, Q. Explore driving factors to energy consumption of electric vehicles based on structural equation modeling. International J. Green. Energy, 1–11. (2024).
-
- Skuza, A., Szumska, E. M., Jurecki, R. & Pawelec, A. modeling the impact of traffic parameters on electric vehicle energy consumption. Energies, 17(21), 5423. (2024).
Grants and funding
LinkOut - more resources
Full Text Sources