top of page
Search

Predicting EVs Battery Type - MS Power BI and Python

  • Jul 31, 2024
  • 1 min read

Updated: Sep 23, 2024

Electrical Vehicles or EVs can have hybrid - Plug-in Hybrid Electric Vehicle (PHEV) - and purely electric battery or BEV (Battery Electric Vehicle). In this article we will review the machine learning method - Decision Trees - which can be utilized in order to predict the battery type of an electric vehicle. But first, the data!


Exploring the Data


The data contains different features or columns. The same will be used to predict the battery type of the vehicle.


Some vehicle makes, such as Tesla, have only one battery type:

BMW, on the other hand has 2 battery types:




There are myriad ways to visualize the row data and explore its properties. Many good visualizations, like the ones above, can be rendered quickly with MS Power BI.


Predicting Battery Type With Decision Trees


A decision tree is a decision support hierarchical model that uses a tree-like model of decisions and their possible consequences, including chance event outcomes, resource costs, and utility.


Decision trees are Supervised Machine learning algorithm.


Python code for predicting EVs battery type:


  1. Encode the categorical variables:


2. Split the data into Training & Validation Sets:



3. Train the Decision Tree and Validate the results:


As one can see, we can obtain very high accuracy score for the predictions.




 
 
 

Comments


Share Your Thoughts with Us

We Value Your Input

© 2023 by Technology and Code. All Rights Reserved.

bottom of page