# An Application to Predict Range of Electric Two-Wheeler Using Machine Learning Techniques
## 3 Materials and Methods
### ML Models  
Figure 4 illustrates the step-by-step process of the machine learning algorithms and their evaluation used in the study. The flowchart provides a clear visual representation of how the parameters were processed to develop the machine learning model and how it was subsequently evaluated. The process starts with the raw data, which are collected from various sources. The collected data are then preprocessed to remove any noise or unwanted information. After preprocessing, the relevant features are extracted from the data and selected based on their importance. These features are then divided into two datasets, which are training set and validation set. The training set consists of 60 data points and is used to train the machine learning model via 10-fold cross-validation, allowing it to learn patterns and relationships between the features and the target variable. In this technique, the original dataset is randomly divided into 10 equal-sized subsets, also known as \"folds\". The model is then trained on 9 of the folds and tested on the remaining fold. This process is repeated 10 times, each time using a different fold for testing and the remaining folds for training. Furthermore, the training results were used to select the best model for the validation process. The validation set, on the other hand, comprises 40 data points and is used to assess the model's performance. The best performing model is then evaluated using the validation dataset and the evaluation matrix. \begin{table}
\begin{tabular}{c c} \hline \hline
**Attribute** & **Description** \\ \hline Elevation Gain & Total elevation gained in a single trip \\ Battery Consumption & Difference in battery level from start to end of the trip. \\ State of Charge & Categorization of the battery level at the start of the trip \\ Total Acceleration & Number of times acceleration occurred \\ Total Deceleration & Number of times deceleration occurred \\ Distance & Distance travelled in a single trip in km \\ UE\_ID & An ID combining user and two-wheeler information \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Processed dataset. Figure 3: Scatter plot of input vs. output variables: (**a**) battery consumption vs. distance; (**b**) elevation gain vs. distance. In this study, we utilized six different machine learning algorithms to predict the range which is a continuous numerical value. We chose to use regression algorithms as they are commonly used to predict continuous values. In order to conduct this study, we have used java programing language with the help of the weka library. All the algorithms were coded in the same program and the evaluation was given as the output in a csv file. We have used three core algorithms and then used an additive model based on these three algorithms to make it a total of six. The algorithms we have used are KStar (K*), random forest (RF), support vector machine (SVM), and additive regression (AR). Furthermore, we have used the K*, RF, and SVM as the base of AR, thus rounding the total number of algorithms to six. We have used 10-fold cross-validation on these 6 algorithms and the results were stored in a csv file. KStar (K*): As a classifier, KStar relies on the similarity between training and test samples to determine the label for a given occurrence. To differentiate itself from other instance-based learners, it uses a distance function based on entropy. To assign a label to an instance, instance-based learning systems consult a database of labeled examples. The essential assumption is that analogous cases are categorized in the same way. There is a need to settle on a common understanding of \"similar instance\" and \"similar class.\" The associated parts of an instance-based learner are the distance function, which determines the degree of similarity between two instances, and the classification function, which explains how the instance similarity generates a final classification for the new instance [28].