# Comparative Analysis of Classifiers for Classification of Emergency Braking of Road Motor Vehicles
## 4 Methodology
### Quality Estimation and Applying of GA  
For estimating the quality of classifying the emergency braking situations and to verify the degree of optimality of the values of hyperparameters, we used the cross-validation (CV) score. We split the training subset into 5 folds (smaller subsets), and implemented the following two procedures for each of the two folds: first, we trained all classifiers using four (of the five) folds, then we tested the resulting classifier on the remaining (fifth) fold. Taking into account the computational overhead of CV, an eventual application of a brute-force approach for finding the best combinations of values of hyperparameters for the proposed classifiers would be unfeasible. Instead, in our approach, we propose an evolutionary search based on GA. The objective of applying GA is to search for a solution (represented as a chromosome) that results in an optimal value of a given target (fitness) function \(F\). This function usually evaluates the quality with which the given candidate-solution tackles the problem. In our work, we employed the F-score as a fitness function. In addition to the fitness function, we shall define the second domain-specific feature of the GA--the genetic representation of chromosomes. XGBoost and SVM classifiers will have their own representation of chromosomes which contain the discretized values of classifiers' hyperparameters. However, since the considered \(k\)-NN method has only one significant parameter \(k\) (number of nearest neighbors), we omit the chromosome representation for this method and employ an exhaustive search to determine the significant features and \(k\) in the range \([1,\,\ldots\,\,n-1]\), where \(n\) is the number of samples in the training set. The ranges and discretized values of the hyperparameters of XGBoost and SVM, representing the corresponding alleles in chromosomes of GA, are illustrated in Tables 4 and 5. \begin{table}
\begin{tabular}{c c c c} \hline
**Allele** & **Interval of** & **Range** & **Meaning** \\ (**Hyperparameter**) & **Discretization** & **Range** & **Meaning** \\ \hline C & 0.002 & \([0,100]\) & Penalty parameter C of the error term \\ \hline kernel & – & [linear, poly, rbf, sigmoid] & Specifies the kernel type to be used in SVM \\ \hline degree & \(1\) & \([1,5]\) & Degree of the polynomial kernel function. \\  & & & Ignored by all other kernels \\ \hline gamma & 0.1 & \([0.01,100]\) & Kernel coefficient for rbf, poly, and sigmoid \\ \hline coef0 & 0.1 & \([0.01,100]\) & Independent term in kernel function. \\  & & & Significant in poly and sigmoid \\ \hline shrinking & – & [True, False] & Whether to use shrinking heuristic \\ \hline \end{tabular}
\end{table} 
Table 4: Content of chromosome of GA applied for optimizing the values of hyperparameters of SVM. With regard to the SVM chromosome, as described in Table 4, several hyperparameters become meaningless when a specific kernel is applied. In this case, GA ignores the pointless chromosome and, consequently, the CV score is not calculated. Besides the tuning of these hyperparameters, we also select the features pertinent to the dynamics of the accelerator pedal that should participate in the training of the classifier: mP, mR, and aR. Moreover, instead of selecting just two or three of these single features, we also consider additional (compound) features that are obtained by multiplication of these three single features. The parameters of the GA framework are presented in Table 6. The genotype (chromosome) of GA comprises alleles, corresponding to the evolved values (as real numbers) of the hyperparameters of the considered classifiers. The considered size of the evolved population of chromosomes is 40 (parameter Population size in Table 6). The mating pool of each following generation consists of four chromosomes (10% of the population of 40 chromosomes, as indicated by the parameter Selection ratio in Table 6) selected via a binary selection mechanism (parameter Selection in Table 6) plus the best (elite) two chromosomes (parameter Elite in Table 6).