# Explainable AI-Enhanced Human Activity Recognition for Human-Robot Collaboration in Agriculture
## 3 Results
### Model Explainability  
#### 3.2.1 Global Feature Importance: Overview of Key Features Across All Classes  
From this point forward, our focus is shifted to utilizing the SHAP framework to understand the contribution of each feature, namely, the recordings of accelerometers, \(a\), gyroscopes, \(g\), and magnetometers, \(m\), in each direction (\(x,\ y,\ z\)) worn at each body location (chest, cervix, lumbar region, right wrist, left wrist) to the model's output by assigning Shapley values. The global feature importance plot is shown in Figure 4 for the top 20 most important features out of a total of 45 features--(3 types of sensors) \(\times\) (3 directions) \(\times\) (5 body locations)--used in the model. The horizontal bars in Figure 4 represent the average impact of each feature on the model's output magnitude, aggregated across all samples. Obviously, \"my_lumbar region\", \"my_cervix\", and \"my_chest\" features prove to be the most impactful features, indicating their strong influence on the classification of the investigated human activities. This also demonstrates the impact of magnetometer measurements, a fact that is confirmed by the presence of 12 features associated with magnetometers in the list of the top 20 ones. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Activity** & **Precision** & **Recall** & **F1-Score** \\ \hline Standing still & 0.94 & 0.96 & 0.95 \\ Walking without a crate & 0.96 & 0.97 & 0.97 \\ Bending to approach an empty crate & 0.89 & 0.85 & 0.87 \\ Bending to approach a full crate & 0.90 & 0.83 & 0.86 \\ Lifting an empty crate & 0.93 & 0.91 & 0.92 \\ Lifting a full crate & 0.93 & 0.92 & 0.92 \\ Walking with an empty crate & 0.90 & 0.91 & 0.90 \\ Walking with a full crate & 0.91 & 0.92 & 0.91 \\ Placing an empty crate onto the UGV & 0.93 & 0.85 & 0.89 \\ Placing a full crate onto the UGV & 0.91 & 0.92 & 0.92 \\ \hline
**Accuracy** & & & 0.93 \\
**Macro average** & 0.92 & 0.90 & 0.91 \\
**Weighted average** & 0.93 & 0.93 & 0.93 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Classification report for the proposed model’s performance. The dominant impact of magnetometers was also highlighted in [27]. Thus, it seems that although new--but similar--activities were added, as compared to the activities taken into account in [27], magnetometers still play a crucial role in HAR. Additionally, [PERSON] et al. [27] proved that sensors worn on the chest, lumbar region, and cervix provide the most stable and consistent data, as their central location contributes to accurately capturing core movements. This is ascertained by the first three most impactful features in the present analysis. Figure 4: SHapley Additive exPlanation (SHAP) variable importance plot ranking the top 20 model features in decreasing order of contribution. Figure 3: Confusion matrix for the employed XGBoost classifier with Class 0: standing still; Class 1: walking without a crate; Class 2: bending to approach an empty crate; Class 3: bending to approach a full crate; Class 4: lifting an empty crate; Class 5: lifting a full crate; Class 6: walking with an empty crate; Class 7: walking with a full crate; Class 8: placing an empty crate onto the UGV; Class 9: placing a full crate onto the UGV. As noted in [27], sensors worn on the wrists presented challenges in recognizing clear patterns. In contrast, the present analysis, as shown in Figure 4, demonstrates that certain components of the IMUs worn on the wrists, particularly features like \"ax_right_wrist\" and \"my_left_wrist\", prove to be sufficiently important for classifying the examined activities. This difference can be attributed to the broader range of activities considered in the present study compared to [27]. While [27] focused on general activities, such as lifting a crate, bending to approach a crate, walking with a crate, and placing a crate onto a UGV, the current analysis introduces an additional layer of granularity by distinguishing between these activities based on the weight of the crate (full or empty).