# MEMS and IoT in HAR: Effective Monitoring for the Health of Older People
## 5 Data Analysis
### Prediction
\begin{table}
\begin{tabular}{c c c c c} \hline \hline  & **Precision** & **Recall** & **F1-Score** & **Accuracy** \\ \hline Arm Cir. Mov. & 0.84 & 0.91 & 0.87 & 0.91 \\ \hline Walking & 0.79 & 0.87 & 0.83 & 0.87 \\ \hline Grasping & 0.88 & 0.87 & 0.88 & 0.87 \\ \hline Leg Flexion & 0.81 & 0.67 & 0.74 & 0.67 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Evaluation metrics. Figure 17: SELU function. Figure 18: ROC curve. The metrics compared between the suggested model and others have shown that the Random Forest model significantly outperforms the SNN in all key indicators. A detailed examination of the individual metrics reveals the following:  
1. Accuracy reflects the proportion of correct forecasts out of the total forecasts made. The Random Forest model achieves impressive accuracy rates of 0.998885 for arm circular movements, 0.998885 for walking, 0.998857 for grasping, and 0.998665 for leg flexion, correctly classifying most samples. In contrast, the SNN model has an accuracy of 0.91 for arm circular movements, 0.87 for walking, 0.87 for grasping, and 0.67 for leg flexion, indicating more classification errors;
2. Precision is defined as the proportion of true positives among all samples classified as positive. The Random Forest model has a precision of 0.998875 for arm circular movements, 0.998765 for walking, 0.998675 for grasping, and 0.998657 for leg flexion, accurately predicting positive classes across all samples. Conversely, the SNN model has a precision of 0.84 for arm circular movements, 0.79 for walking, 0.88 for grasping, and 0.81 for leg flexion. This suggests that the SNN has a higher likelihood of false positives, meaning samples classified as positive may not be;
3. Recall measures the proportion of true positives among all positive samples. The Random Forest model demonstrates recall rates of 0.998885 for arm circular movements, 0.998786 for walking, 0.998775 for grasping, and 0.998665 for leg flexion, successfully identifying 100% of positive samples. In comparison, the SNN model's recall is only 0.91 for arm circular movements, 0.87 for walking, and 0.87 for grasping, indicating it fails to identify a significant number of positive samples, resulting in a higher incidence of false negatives;
4. F1 Score is the harmonic average of precision and recall, providing a balanced measure of a model's performance. The Random Forest model achieves F1 scores of 0.998857 for arm circular movements, 0.998783 for walking, 0.998763 for grasping, and 0.998648 for leg flexion, reflecting a good balance between precision and recall. In contrast, the SNN model's F1 scores are 0.87 for arm circular movements, 0.83 for walking, 0.88 for grasping, and 0.74 for leg flexion, indicating difficulties in maintaining an effective balance between these metrics. The evaluation also included the ROC curves generated for the proposed model and the comparison network. Once again, the Random Forest model demonstrated superior performance. Overall, the best performance metrics indicate that the Random Forest model is more reliable and accurate in predicting activities, effectively minimizing false positives and negatives. In the field of human activity recognition (HAR), the choice of predictive model is crucial to ensure accuracy and reliability. In this study, we initially compared two models, Random Forest and Self-normalizing Neural Network (SNN). While both models demonstrated good performance, with Random Forest showing increased accuracy and robustness, the need arose to explore further solutions that could further improve the ability to recognize tasks. The model chosen was the LSTM (Long Short-Term Memory). This network represents an advanced solution for the recognition of human activities, thanks to their ability to manage timelines and capture long-term dependencies. This makes it ideal for analyzing continuous and complex movements, improving accuracy in recognizing activities that develop over time.