# Context-Aware Complex Human Activity Recognition Using Hybrid Deep Learning Models
## 5 Result and Discussion
### Recognition Accuracy for Simple and Complex Activities  
The confusion matrices in Figures 11 and 12 provide insights into the classification errors by the noncontextual and contextual models, respectively. This result is based on the performance of the models' classifier after being evaluated on the hold-out test dataset that was never used during the training and validation phases. From these figures, accuracies  
Figure 10: Line plot comparing (**a**) validation accuracy and (**b**) validation loss between the two models during training. Figure 9: Line plot comparing (**a**) training accuracy and (**b**) training loss between the two models during training. Table 5 provides the percentage accuracy by class using the macro average F-score. It is not surprising to see the weighted average or the micro-average having higher percentages; this is often due to the skewness in the dataset. As earlier noted in Section 5.1, the macro-average percentage ensures that, despite the imbalanced dataset, each class has equal representation in the overall accuracy percentage considering the size of class samples. Overall, the _contextual_ model achieved 98.72% accuracy, while the noncontextual model trailed behind at 96.19%, indicating that the rich context data provided by the ambient sensors are instrumental to the improved performance. Table 6 shows that there is about 2.62% overall model improvement by infusing context data into the models. As shown in Table 4, for both simple and complex activities, the context-aware model produced higher recognition accuracies. From Figure 11, the noncontextual model achieved an outstanding recognition accuracy of 98.7% on simple activities and a modest 93.7% on complex activities. However, the _contextual_ model was able to achieve a state-of-the-art performance in both simple and complex activities recording an average performance of 99.6% and 97.8, respectively. \begin{table}
\begin{tabular}{l c} \hline \hline
**Model** & **Accuracy** \\ \hline _Noncontextual_ & 96.19\% \\ \hline _Contextual_ & 98.72\% \\ \hline \hline \end{tabular}
\end{table} 
Table 6: Overall model accuracy. \begin{table}
\begin{tabular}{l l l l} \hline \hline \multirow{2}{*}{**Model**} & \multicolumn{2}{c}{**Activity Category**} \\ \cline{2-4}  & \multicolumn{1}{c}{**Simple**} & \multicolumn{1}{c}{**Complex**} \\ \hline _Noncontextual_ & 98.7\% & 93.7\% \\ \hline _Contextual_ & 99.6\% & 97.8\% \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Model accuracy by activity category. \begin{table}
\begin{tabular}{l l l l} \hline \hline \multirow{2}{*}{**\#**} & \multirow{2}{*}{**Activity**} & \multicolumn{2}{c}{**F-Score**} \\ \cline{3-4}  & & \multicolumn{1}{c}{**Noncontextual**} & \multicolumn{1}{c}{**Contextual**} \\ \hline
1 & Jogging & 0.976 & 0.992 \\ \hline
2 & Lying & 0.998 & 1.000 \\ \hline
3 & Running & 0.993 & 1.000 \\ \hline
4 & Sitting & 0.970 & 0.990 \\ \hline
5 & Standing & 0.995 & 0.997 \\ \hline
6 & Walking & 0.991 & 0.996 \\ \hline
7 & Ascending Stairs & 0.944 & 0.961 \\ \hline
8 & Descending Stairs & 0.943 & 0.955 \\ \hline
9 & Elevator Down & 0.985 & 0.992 \\ \hline
10 & Elevator Up & 0.984 & 0.991 \\ \hline
11 & Mountain Climbing & 0.774 & 0.981 \\ \hline
12 & Riding in car & 0.990 & 0.990 \\ \hline  & accuracy & 0.989 & 0.995 \\ \cline{2-4}  & macro-average & 0.962 & 0.987 \\ \cline{2-4}  & weighted average & 0.989 & 0.995 \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Model accuracy by activity class. Both models were able to distinguish between several different simple activities effectively. Although the two models recorded their individual lowest accuracies for simple activities in the Jogging and Sitting labels, the _contextual_ model still managed to record at least 99% in these two classes (Table 6). In the complex activity category, the noncontextual model performed woefully generalizing the Mountain Climbing activity with a 77.4% accuracy compared to 98.1% by the _contextual_ model. Interestingly, the two models performed equally well in recognizing Driving activity.