# Improved Prediction of Total Energy Consumption and Feature Analysis in Electric Vehicles Using Machine Learning and Shapley Additive Explanations Method

^{*}

^{†}

## Abstract

**:**

^{2}(0.92). Trip distance, power, heating, and odometer reading were the most important features influencing the TEC, identified using the shapley additive explanations method.

## 1. Introduction

_{2}emissions, have influenced companies and governments to explore and adopt alternative clean energy options [1,2,3]. The most comprehensive and promising approach for reducing air pollution is to use EVs [4,5]. As a result, governments encourage citizens to buy and use EVs instead of gasoline-powered automobiles [4,6]. EVs convert 77% of electrical energy from the grid to power at the wheel, according to the report from the U.S. Department of Energy.

_{2}levels by at least 40% by 2030 [9]. With the global increase of the EVs market, accurate power prediction has become crucial, as electric cars cannot refuel as fast as conventional fuel-operated vehicles [10].

## 2. Methodology

#### 2.1. Data Source and Preparation

#### 2.2. Model Building

## 3. Results and Discussion

^{2}) was 0.768 for trip distance vs. TEC, and the lowest was for driving style vs. TEC. This pairwise correlation helps to determine each independent variable’s significance for the total energy consumed by the electric vehicle used in this study. The pairwise correlation provided information that there is no existing collinearity between any of the independent variables.

^{2}, and MAE were calculated for MLR, SVR, and XGBoost models. We found that the value of R

^{2}obtained using XGBoost is 91.86%, which is higher than MLR (83.42%) and SVR (88.48%) ML models. Similarly, to measure the magnitude of error, RMSE was calculated. The value of RMSE obtained using XGBoost was 9.49 kWh, which is lower than the RMSE obtained using SVR (10.71 kWh) and MLR (12.93 kWh). This shows that the predicted data better fit over test data with minimal error compared to the SVR and MLR. Our values are consistent with the range of values reported in the literature [5].

^{2}), also known as the coefficient of determination. It was calculated to determine the percentage of variance collectively explained by the independent variable in the dependent variable. This R

^{2}(ranging from 0 to 100%) was used to measure the strength of the relationship between the dependent variable and the performance of the developed model. The R

^{2}for the MLR model between the observed dataset and predicted values was calculated to be 0.83. The RMSE for the test dataset was estimated to be 12.93 kWh, and the MAE was 3.91 kWh. The parity plot of Figure 3A shows the fit of the SVR model predicting TEC using multiple external factors (independent variables). The R

^{2}calculated using the SVR model was higher than the MLR model, as the SVR model considers its hyper line with the maximum number of points. The linear fit line using the SVR model had less variation than MLR. The RMSE and MAE calculated using the SVR model were 10.71 kWh and 4.69 kWh, respectively. The scatter plot shown in Figure 3B shows the comparison of predicted values and the observed dataset obtained by using a single independent variable (trip distance) with the highest correlation value. The R

^{2}calculated using the SVR model for this comparison is 0.79, showing that the prediction using only one parameter is lower than using multiple independent variables. This proves that TEC is affected by various factors and not only by the trip distance.

^{2}values utilizing this model were calculated to be 0.92, which is the highest among all the three ML models. The RMSE and MAE errors calculated were 9.49 kWh and 4.55 kWh, respectively. Minimal variation and better linear fit can be seen in the scatter plot obtained using XGBoost, in comparison with both MLR and SVR models. The result shows that the XGBoost model is more effective in predicting the total power consumption of electric vehicles (Tesla Model S) than SVR and MLR using the external factors (independent variables used in this study).

## 4. Conclusions

## Author Contributions

## Funding

## Data Availability Statement

## Acknowledgments

## Conflicts of Interest

## References

- Lin, X.; Bogdan, P.; Chang, N.; Pedram, M. Machine learning-based energy management in a hybrid electric vehicle to minimize total operating cost. In Proceedings of the 2015 IEEE/ACM International Conference on Computer-Aided Design (ICCAD), Austin, TX, USA, 2–6 November 2015; pp. 627–634. [Google Scholar]
- Zhang, R.; Yao, E. Electric vehicles’ energy consumption estimation with real driving condition data. Transp. Res. Part D Transp. Environ.
**2015**, 41, 177–187. [Google Scholar] [CrossRef] - Fukushima, A.; Yano, T.; Imahara, S.; Aisu, H.; Shimokawa, Y.; Shibata, Y. Prediction of energy consumption for new electric vehicle models by machine learning. IET Intell. Transp. Syst.
**2018**, 12, 1174–1180. [Google Scholar] [CrossRef] - Amirkhani, A.; Haghanifar, A.; Mosavi, M.R. Electric Vehicles Driving Range and Energy Consumption Investigation: A Comparative Study of Machine Learning Techniques. In Proceedings of the 2019 5th Iranian Conference on Signal Processing and Intelligent Systems (ICSPIS), Shahrood, Iran, 18–19 December 2019; pp. 1–6. [Google Scholar]
- Shahriar, S.; Al-Ali, A.R.; Osman, A.H.; Dhou, S.; Nijim, M. Machine Learning Approaches for EV Charging Behavior: A Review. IEEE Access
**2020**, 8, 168980–168993. [Google Scholar] [CrossRef] - Huang, Y.; Wang, H.; Khajepour, A.; He, H.; Ji, J. Model predictive control power management strategies for HEVs: A review. J. Power Sources
**2017**, 341, 91–106. [Google Scholar] [CrossRef] - U.S. Department of Energy. All-Electric Vehicles. Available online: https://www.fueleconomy.gov/feg/evtech.shtml (accessed on 1 May 2021).
- Krosnick, J.; MacInnis, B. Climate Insights 2020: Policies and Politics. Available online: https://www.rff.org/publications/reports/climateinsights2020-policies-and-politics/ (accessed on 23 September 2020).
- Straka, M.; Carvalho, R.; Van Der Poel, G.; Buzna, L.U. Analysis of Energy Consumption at Slow Charging Infrastructure for Electric Vehicles. IEEE Access
**2021**, 9, 53885–53901. [Google Scholar] [CrossRef] - Hong, J.; Park, S.; Chang, N. Accurate remaining range estimation for electric vehicles. In Proceedings of the 2016 21st Asia and South Pacific Design Automation Conference (ASP-DAC), Macao, China, 25–28 January 2016; pp. 781–786. [Google Scholar]
- Lim, M.k.; Mak, H.Y.; Rong, Y. Toward Mass Adoption of Electric Vehicles: Impact of the Range and Resale Anxieties. Manuf. Serv. Oper. Manag.
**2015**, 17, 101–119. [Google Scholar] [CrossRef] - De Cauwer, C.; Van Mierlo, J.; Coosemans, T. Energy Consumption Prediction for Electric Vehicles based on Read-World Data. Energies
**2015**, 8, 8573–8593. [Google Scholar] [CrossRef] - De Cauwer, C.; Verbeke, W.; Coosemans, T.; Faid, S.; Van Mierlo, J. A data-driven method for energy consumption prediction and energy-efficient routing of electric vehicles in real-world conditions. Energies
**2017**, 10, 608. [Google Scholar] [CrossRef] [Green Version] - Shankar, R.; Marco, J. Method for estimating the energy consumption of electric vehicles and plug-in hybrid electric vehicles under real-world driving conditions. IET Intell. Transp. Syst.
**2013**, 7, 138–150. [Google Scholar] [CrossRef] - Wu, X.; Freese, D.; Cabrera, A.; Kitch, W.A. Electric vehicles’ energy consumption measurement and estimation. Transp. Res. Part D Transp. Environ.
**2015**, 34, 52–67. [Google Scholar] [CrossRef] - Sun, S.; Zhang, J.; Bi, J.; Wang, Y. A machine learning method for predicting driving range of battery electric vehicles. J. Adv. Transp.
**2019**, 2019, 1–14. [Google Scholar] [CrossRef] - Iora, P.; Tribioli, L. Effect of ambient temperature on electric vehicles’ energy consumption and range: Model definition and sensitivity analysis based on nissan leaf data. World Electr. Veh. J.
**2019**, 10, 2. [Google Scholar] [CrossRef] [Green Version] - Ma, F.; Yan, X. Research on the Energy Consumption Estimation Method of Pure Electric Vehicle Based on XGBoost. In Proceedings of the 2019 3rd International Conference on Electronic Information Technology and Computer Engineering (EITCE), Xiamen, China, 18–20 October 2019; pp. 1021–1026. [Google Scholar]
- Torlay, L.; Perrone-Bertolotti, M.; Thomas, E.; Baciu, M. Machine learning–XGBoost analysis of language networks to classify patients with epilepsy. Brain Inform.
**2017**, 4, 159–169. [Google Scholar] [CrossRef] [PubMed] - Lin, X.; Zhang, G.; Wei, S.; Yin, Y. Energy consumption estimation model for dual-motor electric vehicles based on multiple linear regression. Int. J. Green Energy
**2020**, 17, 488–500. [Google Scholar] [CrossRef] - Lucas, A.; Barranco, R.; Refa, N. EV idle time estimation on charging infrastructure, comparing supervised machine learning regressions. Energies
**2019**, 12, 269. [Google Scholar] [CrossRef] [Green Version] - Chen, Y.; Alamin, K.S.S.; Jahier Pagliari, D.; Vinco, S.; Macii, E. Poncino. Electric Vehicles Plug-In Duration Forecasting Using Machine Learning for Battery Optimization. Energies
**2020**, 13, 4208. [Google Scholar] [CrossRef] - Almaghrebi, A.; Aljuheshi, F.; Rafaie, M.; James, K.; Alahmad, M. Data-Driven Charging Demand Prediction at Public Charging Stations Using Supervised Machine Learning Regression Methods. Energies
**2020**, 13, 4231. [Google Scholar] [CrossRef] - Chandran, V.; Patil, C.; Karthick, A.; Ganeshaperumal, D.; Rahim, R.; Ghosh, A. State of Charge Estimation of Lithium-Ion Batteryfor Electric Vehicles Using Machine Learning Algorithms. World Electr. Veh. J.
**2021**, 12, 38. [Google Scholar] [CrossRef]

**Figure 2.**Plot of multiple linear regression ML model prediction for test data compared with the actual values.

**Figure 3.**Support vector regression plot of predicted data vs. test data: (

**A**) all independent variables considered, and (

**B**) single independent variable (trip distance).

**Figure 5.**SHAP summary of the relative importance of various features used in the prediction of total energy consumption of the EVs.

EV Model | Tire Type | Driving Style | Power (kW) | Odometer (Miles) | Trip Distance (km) | City | Motor Way | Country Roads | A/C | Park Heating | Total Energy Consumption (kWh) |
---|---|---|---|---|---|---|---|---|---|---|---|

Tesla Model S | Winter | normal | 225 | 88,514 | 67.5 | Yes | Yes | Yes | Yes | Off | 11.29 |

Tesla Model S | All-year | moderate | 267 | 185,973 | 2.4 | Yes | No | No | Yes | Off | 0.55 |

Tesla Model S | Summer | normal | 257 | 64,924 | 142 | No | Yes | Yes | Yes | On | 34.02 |

**Table 2.**Pairwise correlation analysis between each independent variable and the dependent variable.

Dependent Variable | Independent Variable | Correlation Coefficient (r) | Confidence Interval | R^{2} |
---|---|---|---|---|

Total Energy Consumption (kWh) | Trip distance (km) | 0.8766 | (0.87, 0.88) | 0.7685 |

Total Energy Consumption (kWh) | Motor way | 0.0852 | (0.07, 0.1) | 0.0073 |

Total Energy Consumption (kWh) | Version | 0.0782 | (0.06, 0.1) | 0.0061 |

Total Energy Consumption (kWh) | Power (kW) | 0.0687 | (0.05, 0.09) | 0.0047 |

Total Energy Consumption (kWh) | Park heating | 0.0586 | (0.04, 0.08) | 0.0034 |

Total Energy Consumption (kWh) | Country roads | 0.0021 | (−0.01, 0.02) | 0.0000 |

Total Energy Consumption (kWh) | Tire type | −0.0110 | (−0.03, 0.01) | 0.0001 |

Total Energy Consumption (kWh) | City | −0.0118 | (−0.03, 0.01) | 0.0001 |

Total Energy Consumption (kWh) | Odometer | −0.0139 | (−0.03, 0.003) | 0.0002 |

Total Energy Consumption (kWh) | A/C | −0.0253 | (−0.04, −0.01) | 0.0006 |

Total Energy Consumption (kWh) | Driving style | −0.0382 | (−0.06, −0.02) | 0.0015 |

ML Model | R-Squared (R^{2}) | Mean Absolute Error (kWh) | Root Mean Square Error (kWh) | Accuracy (%) |
---|---|---|---|---|

MLR | 0.8342 | 3.909 | 12.926 | 83.42 |

SVR | 0.8848 | 4.691 | 10.707 | 88.49 |

XGBoost | 0.9186 | 4.551 | 9.490 | 91.86 |

Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |

© 2021 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Pokharel, S.; Sah, P.; Ganta, D.
Improved Prediction of Total Energy Consumption and Feature Analysis in Electric Vehicles Using Machine Learning and Shapley Additive Explanations Method. *World Electr. Veh. J.* **2021**, *12*, 94.
https://doi.org/10.3390/wevj12030094

**AMA Style**

Pokharel S, Sah P, Ganta D.
Improved Prediction of Total Energy Consumption and Feature Analysis in Electric Vehicles Using Machine Learning and Shapley Additive Explanations Method. *World Electric Vehicle Journal*. 2021; 12(3):94.
https://doi.org/10.3390/wevj12030094

**Chicago/Turabian Style**

Pokharel, Sugam, Pradip Sah, and Deepak Ganta.
2021. "Improved Prediction of Total Energy Consumption and Feature Analysis in Electric Vehicles Using Machine Learning and Shapley Additive Explanations Method" *World Electric Vehicle Journal* 12, no. 3: 94.
https://doi.org/10.3390/wevj12030094