## 4 Comparison of HMM and LSTM
### Comparison of STM-HMM and STM-LSTM-Based Fall Detection System  
Figure 6 shows the confusion matrix applying five types of single parameter to the proposed STM-LSTM-based fall detection system. The reason why there is no walking pattern in the confusion matrix except for the single parameter \(P_{S}\) is that the LSTM inference is not applied if the threshold value is not reached, as shown in the algorithm in Figure 3b. Applying the single parameter \(P_{G}\) achieves the best accuracy, sensitivity, and specificity of 100%. In Table 4 and Figure 7, applying the single parameters, the training data performance of the proposed STM-LSTM-based fall detection system is compared with that of the previously reported STM-HMM-based fall detection systems. In Figure 7, the solid and dashed lines denote training data performances of the STM-LSTM and STM-HMM-based fall detection systems, respectively, and the squares, circles, and triangles denote accuracy, sensitivity, and specificity, respectively. This shows the training data performance calculated using the network parameters obtained from the training data (i.e., all 560 data). The best performance of the STM-HMM-based fall detection system is when applying the single parameter \(P_{\theta}\), while that of the STM-LSTM-based fall detection system is when applying the single parameter \(P_{G}\). For all single parameters except for the case of the single parameter \(P_{\theta}\), the performance of the STM-LSTM-based fall detection system is relatively better than that of the STM-HMM-based fall detection system, and the best performance of fall detection is achieved in the STM-LSTM-based fall detection system. Figure 8 shows the training data performance of the proposed STM-LSTM-based fall detection system, applying the multiple parameters. Applying the multiple parameter \(P_{ALL}\) achieves the best accuracy, sensitivity, and specificity of 100%. The squares, circles, and triangles denote accuracy, sensitivity, and specificity, respectively. The average performance with the multiple parameters shows relatively higher accuracy than that with the single parameters. All 560 data are trained with both HMM and LSTM with the algorithm in Figure 3a, and all of them are tested without separating any validation data with the algorithm in Figure 3b. Therefore, they may be overfitted to the extent that accuracy of 100% is obtained for the single parameter \(P_{G}\) and the multiple parameter \(P_{ALL}\). In order to resolve the possible overfitting issue, training and validation data should be evaluated separately in 4:1. \begin{table}
\begin{tabular}{c c c} \hline \hline \multicolumn{2}{c}{**Parameters**} & \multicolumn{1}{c}{**Values**} \\ \hline Learning rate & 0.0025 \\ \hline \multirow{3}{*}{Input layer nodes} & Batch & 560 \\  & Length & 500 \\  & Dimension & 1, 2, 5 \\ \hline Number of hidden layer nodes & 13 \\ Regularization rate & 0.00015 \\ Number of output layer nodes & 7 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: LSTM training model parameters and methods. Figure 6: Confusion matrix applying 5-types of single parameter to the proposed LSTM-based fall detection system. (**a**) \(P_{\theta}\), (**b**) \(P_{S}\), (**c**) \(P_{D}\), (**d**) \(P_{G}\), (**e**) \(P_{GD}\). \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline  & \multicolumn{2}{c}{**Accuracy [\%]**} & \multicolumn{2}{c}{**Sensitivity [\%]**} & \multicolumn{2}{c}{**Specificity [\%]**} \\ \hline  & **LSTM** & **HMM** & **LSTM** & **HMM** & **LSTM** & **HMM** \\ \hline \(P_{\theta}\) & 98.57 & 99.5 & 99.06 & 99.17 & 97.91 & 99.96 \\ \(P_{S}\) & 98.21 & 96.43 & 99.31 & 97.5 & 96.66 & 95.63 \\ \(P_{D}\) & 99.46 & 98.57 & 99.68 & 99.6 & 99.16 & 97.81 \\ \(P_{G}\) & 100 & 97.86 & 100 & 99.17 & 100 & 96.88 \\ \(P_{GD}\) & 98.92 & 98.21 & 99.37 & 99.17 & 98.33 & 97.5 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Fall detection results of the proposed STM-LSTM-based and the previously reported STM-HMM-based fall detection systems, applying the single parameters.