# Context-Aware Complex Human Activity Recognition Using Hybrid Deep Learning Models
## 4 Experiments and Results
### Evaluation Metrics  
We evaluated the classifiers from the two experiments using a hold-out test dataset. The hold-out test data came from users whose data were not used as part of the training and validation data. As part of the data preprocessing stage, the entire dataset was split into training, validation, and testing sets. The test data came from a user; validation data came from two other users, while the remaining data from four other users were used during training. This approach is often referred to as leave-one-subject-out validation in the literature [11]. For both experiments, we used the following metrics: _Precision_, _Recall_, _F-score_, and the confusion matrix. According to many authors, these are the most used metrics for activity recognition [11; 74; 75].  
Before discussing _Precision_, _Recall_, and the _F-score_, we defined the confusion matrix. This is because the precision and recall values, as well as the harmonic mean of precision and recall, i.e., the F-score, can all be computed from the confusion matrix. The confusion matrix provides a summary of the number of instances of different activity classes that the model is confused about, i.e., misclassified by the model [11]. For a more fine-grained analysis of the predictions by the model, the confusion matrix not only provides insight into the performance of a predictive model, but also a breakdown of which classes are being predicted correctly (_True Positive_ and _True Negative_), incorrectly (_False Negative_ and _False Positive_), and the error values. However, the numbers can be strongly biased by dominant activity classes compared to the minority classes and more so when a class imbalance dataset is involved.  
The precision is computed as the sum of _True Positive_ (TP) predictions across all classes divided by the sum of _True Positive_ predictions and _False Positive_ (FP) predictions across all classes. _Precision_ is defined as:  
\[P=TP/(TP+FP) \tag{4}\]  
The recall is another metric that computes the number of True Positive predictions divided by the sum of True Positive and False Negative predictions, i.e.,  
\[R=TP/(TP+FN) \tag{5}\]  
Finally, once the precision and the recall metrics were known, we then computed the F-score, which is the harmonic mean between the recall and precision. The F-score provides a way to combine the precision and recall measures into a single measure that reflects both properties. The F-score remains the commonly used metric for class imbalanced datasets [74]. Considering the imbalanced nature of the dataset and the tendency of the classifier to skew toward the more frequent classes during training, we adopted the macro-average F-score previously used successfully by other scholars [49; 76]. This metric truly reflects the representation of small classes within the dataset, and it is calculated as follows:  
\[F\text{-}Score\ (R,P)=2^{*}RP/(R+P) \tag{6}\]  
\begin{table}
\begin{tabular}{p{113.8 pt} p{113.8 pt} p{113.8 pt} p{113.8 pt}} \hline \hline \# & **Activity** & **Category** & **Subactivity** \\ \hline
8 & Descending Stairs & Complex & Walking + in motion in line with gravity \\ \hline
9 & Elevator Down & Complex & Standing + in motion in line with gravity \\ \hline
10 & Elevator Up & Complex & Standing + in motion against gravity \\ \hline
11 & Mountain Climbing & Complex & Walking + under high altitude \\ \hline
12 & Riding in car & Complex & Sitting + in motion \\ \hline \hline \end{tabular}
\end{table}
Table 1: _Cont._Just like the Precision and Recall measures, a perfect F-score is 1.0, and a poor F-score is 0.