# New Framework for Human Activity Recognition for Wearable Gait Rehabilitation Systems
## 5 Data Classification, Results and Discussion
\begin{table}
\begin{tabular}{c c c c c c c c c} \hline \hline \multirow{2}{*}{**Leg Muscle**} & \multicolumn{3}{c}{**KNN (\%)**} & \multicolumn{3}{c}{**Neural Network (\%)**} & \multicolumn{3}{c}{**Random Forest (\%)**} \\ \cline{2-9}  & **P** & **R** & **F** & **P** & **R** & **F** & **P** & **R** & **F** \\ \hline Soleus & 84.42 & 59.27 & 69.64 & 90.39 & 86.57 & 88.44 & 98.56 & 96.72 & 97.63 \\ Vastusmedialis & 84.67 & 59.09 & 69.59 & 96.43 & 90.71 & 93.48 & 97.65 & 95.69 & 96.66 \\ Vastuslateralis & 91.30 & 65.33 & 76.16 & 96.68 & 92.55 & 94.57 & 96.98 & 95.9 & 96.41 \\ Rectusfemoris & 91.30 & 65.67 & 76.39 & 96.56 & 91.21 & 93.80 & 95.4 & 94.84 & 95.0 \\ Gracilis & 89.71 & 64.60 & 75.11 & 96.89 & 92.60 & 94.68 & 97.49 & 96.75 & 97.11 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Classification results of EMGs after the K-fold validation step. The results for EMGs in Table 3 show that the random forest algorithm provides higher results than the other techniques. The precision (P) varies from 95.4 up to 98.56%, the recall (R) varies from 94.84 up to 96.75% and the F-measure (F) varies from 95 up to 97.63%. The highest assessment values were achieved for the soleus muscle, where the F-score value was 97.63%. The soleus muscle produces the best results when employing a random forest classifier. Figure 13a displays the confusion matrix of three activities (walking, ramping, and stairs) using an EMG sensor. According to the results, all samples were accurately recognized for the third activity (stairs); however, a few samples were incorrectly detected for the first and second activities (walking and ramp). Similarly to EMG, the random forest classifier outperforms the other two classifiers in terms of the aforementioned metrics when utilizing an IMU sensor. The precision (P) varies from 95.03 up to 99.29%, the recall (R) varies from 94.98 up to 98.05% and the F-measure (F) varies from 95.05 up to 98.52%. The best results can be obtained by extracting the gyroscope signal in the Y direction from the shank muscle. The classification results of the three gyroscope signal activities in the Y direction that were taken from the IMU sensor using a random forest classifier are displayed in the confusion matrix in Figure 13b. The findings showed that while all samples were correctly identified for the third activity (stairs), several samples were misidentified for the first and second activities (walking and ramp). The results are shown in Table 4.  
The previous results indicate that the best discrimination between the different activities can be achieved by using an EMG signal collected from the soleus muscle or by using a signal extracted from an IMU sensor located on the shank muscle. These obtained results can be compared to other HAR approaches that are mentioned in the literature, as can be \begin{table}
\begin{tabular}{c c c c c c c c c c} \hline \hline \multirow{2}{*}{**Sensor Place on the Leg**} & \multicolumn{3}{c}{**KNN (\%)**} & \multicolumn{3}{c}{**Neural Network (\%)**} & \multicolumn{3}{c}{**Random Forest (\%)**} \\ \cline{2-10}  & **P** & **R** & **F** & **P** & **R** & **F** & **P** & **R** & **F** \\ \hline foot\_Accel\_X & 83.43 & 66.02 & 73.71 & 95.00 & 92.64 & 93.79 & 95.61 & 95.00 & 95.26 \\ foot\_Gyro\_Z & 86.50 & 71.67 & 78.39 & 91.95 & 88.46 & 90.16 & 97.22 & 98.05 & 97.63 \\ shank\_Accel\_X & 82.75 & 65.18 & 72.83 & 90.62 & 88.29 & 89.43 & 95.03 & 96.28 & 95.55 \\ shank\_Accel\_Y & 79.70 & 60.51 & 68.66 & 92.19 & 87.80 & 89.94 & 95.14 & 94.98 & 94.98 \\ shank\_Accel\_Z & 79.81 & 61.28 & 69.27 & 91.02 & 71.42 & 77.45 & 96.12 & 97.19 & 96.61 \\ shank\_Gyro\_Y & 89.14 & 70.21 & 78.53 & 92.63 & 72.30 & 78.68 & 99.29 & 97.76 & 98.52 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Classification results for IMUs after the K-fold validation step. Figure 13: (a) Confusion matrix for EMG sensor classification results. (b) Confusion matrix for IMU sensor classification results. seen in Table 5. Hence, the results achieved can be seen as comparable and successful to other research results.