# New Framework for Human Activity Recognition for Wearable Gait Rehabilitation Systems
## 5 Data Classification, Results and Discussion  
The last step in the proposed framework is data classification for activity recognition. The utilized hardware is a computer with an Intel i7 core processor, 2.6 GHz speed and 16 GB RAM. The utilized benchmark dataset, 'Georgia Tech dataset' [27], consists of three main activities (walking, stairs and ramp) with a total of 2511 samples collected from 22 able-bodied adults for multiple locomotion modes. The sensors are applied over 11 muscles using EMG sensors sampled at 1000 Hz. Inertial measurement unit data are collected from four different muscles: trunk, thigh, shank, and foot segments sampled at 200 Hz. The samples are divided into training and testing samples for different activities, as can be shown in Table 2. The proportion of training samples to testing samples is 70% to 30%. \begin{table}
\begin{tabular}{c c} \hline \hline
**Extracted Feature** & **Mathematical Expression** \\ \hline Autocepstral Peak & \(max_{a}(\hat{n})=\dfrac{1}{\sqrt{N_{r}}}\sum\limits_{k=0}^{N_{r}-1}Z\left( \hat{k}\right)exp\left(\dfrac{2\pi\hat{k}\hat{n}}{N_{r}}\right)\) \\ \hline Skewness & \(\dfrac{E\left(x-\hat{n}\right)^{3}}{\sigma^{3}}\) \\ \hline Kurtosis & \(\dfrac{E\left(x-\hat{n}\right)^{4}}{\sigma^{4}}\) \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Mathematical expressions of the extracted features. The applied classifiers are K-nearest neighbor, neural networks and random forest. For KNN, the number of neighbors is three, equal distance weighting is used and the distance metric technique is Euclidean distance. The utilized neural network is a feedforward NN with 1 hidden layer, ReLU is the activation function, 100 epochs and stochastic gradient descent as an optimizer. The third classifier, random forest, has several trees equal to seven. For results analysis and assessment, _precision (P)_, _recall (R)_, and _F-measure_ are calculated. Their equations are shown in Equations (3)-(5) as follows:  
\[\text{{Precision }}(P)=\frac{TP}{TP+FP}, \tag{3}\]  
\[\text{{Recall }}(R)=\frac{TP}{TP+FN}, \tag{4}\]  
\[\text{{F-measure }}(F)=2\frac{P\times R}{P+R} \tag{5}\]  
where _TP_ represents the number of correctly detected activities, _FN_ represents the number of undetected activities, and _FP_ represents the number of incorrectly detected activities. The full obtained results are shown for EMGs and IMUs in the Appendix A (Tables A1 and A2), respectively. For further validation of the obtained results, a threefold K-fold cross-validation technique is used. The dataset is split up into three folds. Each iteration uses a single fold as testing data and the other folds as training data. Consequently, the procedure is repeated until every dataset has been assessed. The mean score of the evaluation metrics values is typically used to represent the K-fold results. The classification results obtained for EMGs and IMUs are shown in Tables 3 and 4, respectively, where the highest five sensors results in terms of P, R and F are displayed with respect to other sensors. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Sensor** & **Activity** & \begin{tabular}{c} **Total Number** \\ **of Samples** \\ \end{tabular} & \
\begin{tabular}{c} **No. of Training** \\ **Samples** \\ \end{tabular} &
\begin{tabular}{c} **No. of Testing** \\ **Samples** \\ \end{tabular} \\ \hline EMG & Walking & 199 & 139 & 60 \\  & Ramp & 1394 & 952 & 419 \\  & Stairs & 918 & 642 & 276 \\ \hline  & Walking & 221 & 155 & 66 \\  & Ramp & 1360 & 952 & 408 \\  & Stairs & 916 & 641 & 275 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: The details of sensor samples that were used in classification.