## 3 Classifier Training and Results
### Head Gesture Recognition Rates for T1 and T2 Testing Scenarios
\begin{table}
\begin{tabular}{c c c c c c} \hline \hline  & **Recognised:** & **Recognised:** & **Recognised:** & **Recognised:** & \\  & **Pitch** & **Roll** & **Yaw** & **Immobility** & \\ \hline True: Pitch & 92.0\% & 1.1\% & 1.4\% & 5.5\% & 100\% \\ True: Roll & 1.1\% & 91.7\% & 2.6\% & 4.6\% & 100\% \\ True: Yaw & 3.5\% & 1.8\% & 91.3\% & 3.4\% & 100\% \\ True: Immobility & 1.2\% & 2.8\% & 3.4\% & 92.6\% & 100\% \\ \hline \hline \end{tabular}
\end{table} 
Table 3: The confusion matrix showing inter-gesture recognition errors for the SVM classifier with a 3 rd degree polynomial and \(C=1.0\) (the classifier trained on parametrised IMU signals). \begin{table}
\begin{tabular}{c c c c c c} \hline \hline  & **Recognised:** & **Recognised:** & **Recognised:** & **Recognised:** & \\  & **Pitch** & **Roll** & **Yaw** & **Immobility** & \\ \hline True: Pitch & 95.3\% & 0.3\% & 0.5\% & 3.9\% & 100\% \\ True: Roll & 0.3\% & 96.1\% & 1.8\% & 1.8\% & 100\% \\ True: Yaw & 0.6\% & 1.3\% & 93.8\% & 4.3\% & 100\% \\ True: Immobility & 0.5\% & 0.2\% & 0.5\% & 98.8\% & 100\% \\ \hline \hline \end{tabular}
\end{table} 
Table 5: The confusion matrix showing inter-gesture recognition errors for the SVM classifier with an RBF kernel and \(C=10.0\) (the classifier trained on IMU signal samples). Overall, however, the gesture recognition rates were better for the SVM classifier trained on IMU signal samples than the classifier trained on the parametrized IMU signals (compare the matrix diagonals in Tables 3 and 5, and also sensitivities, specificities and F1-scores in Tables 4 and 6). The training times of the classifiers were also evaluated. The computations were performed on an Intel Core i5-7500, 16 GB RAM, Windows 10 64-bit PC. Scripts were written in Python in the Enthought Canopy environment using the Sklearn module. The obtained calculation times required for training the classifiers are presented in Table 7.  
Depending on the types of datasets (42-element or 6-element vectors), a different size of the training datasets was used, hence the training times of the classifiers varied significantly. For the 42-element training vectors, the longest training time did not exceed 6 min. The training procedure was the fastest for the \(k\)-NN classifier. On the other hand, it took several minutes to train the SVM classifier. For the 6-element training vectors (and larger training datasets), the shortest training times were obtained for the \(k\)-NN classifiers. Training of the decision trees (and random forests) took tens of seconds while the longest training times were required for the SVM classifiers (a few hours). Table 8 shows the time necessary to recognize a head gesture from a single vector by the trained classifiers. \begin{table}
\begin{tabular}{c c c c c} \hline
**No.** & **Classifier** & **Parametrized IMU Signals** & **Raw IMU Signals** \\ \hline
1. & Decision tree & 12.6 s & 18 s \\
2. & Decision tree with a minimum of 5 samples & 11.9 s & 17 s \\
3. & Random forest & 9.2 s & 52 s \\
4. & Random forest with a minimum of 5 & 8.8 s & 50 s \\
5. & k-NN for k e (1.3, 5.7, 9.1, 11, 13, 15, 17, 19] & 0.6 s & 2 s \\
6. & SVM with an RBF kernel for & 5 min, 17 s & from 2 h, 27 min to 8 h, 42 min * \\
7. & SVM with a 3 rd degree polynomial kernel & 2 min, 12 s & from 2 h, 46 min to 9 h, 57 min * \\ \hline \end{tabular}
\end{table} 
Table 7: Training times of the classifiers.