# AI-Based Stroke Disease Prediction System Using Real-Time Electromyography Signals
## 4 Experiments and Analysis
### Experiment and Analysis Based on Deep Learning  
This section will go through the results of LSTM which are based on a Recent Neural Network (RNN) for the classification of stroke patients and non-stroke patients in the elderly. Raw data from EMG bio-signals were used as defined in Section 4.1. Data from 271 stroke patients and 271 normal patients were used to generate prediction models and verify their accuracies. Learning data sets were randomly extracted, and the data not used for learning became the test sets. The experiment and analysis were carried out by dividing them into ratios of 70 to 30 and 80 to 20, respectively. LSTM was chosen among other deep learning algorithms due to its performance in the time series analysis. This LSTM consists of a structure that explicitly transfers past information to the next state, and by learning long-term dependencies, the cell state serves to convey past information to the next step [41; 42; 43; 44]. Deep Learning's LSTM has overcome the structural shortcomings of the existing RNN and can solve the problem of having a vanishing gradient when error values are propagated to the neural network layer [41; 42; 45; 47]. LSTM consists of a cell state, an input gate, a forget gate, and an output gate, and vector output values at each gate are generated via the sigmoid layer and the tanh layer (see Figure 5). Before the experiment, the Z-score normalization process was carried out as shown in Equation (3) of Section 4.2 for each point of raw EMG bio-signals data from the left and right biceps femoris and gastrocnemius muscle. In this experiment, the same weights were applied for each measurement value by converting the values of the four raw data by location into smaller ranges from 0.0 to 1.0. The \(x_{t}\) refers to the input vector value for the four bio-signals of the EMGs at point \(t\). The forget gate layer takes \(l_{t-1}\) and \(x_{t}\) as input values. The input \(x_{t}\) outputs \(f_{t}\), which is the value given by the activation function sigmoid function \(\sigma\), and determines whether or not the information is transferred to the cell state as shown in Equation (4) below. \[f_{t}=\sigma\Big{(}W_{f^{{}^{\prime}}}\left[h_{t-1},\ x_{t}\right]+b_{f}\Big{)} \tag{4}\]  
Figure 5: Structural Diagram of LSTM based on EMG Biometric Signals. Since \(f_{t}\) is the output value of the sigmoid function, it has a value between 0 and 1. The closer this value is to 1, the more likely it is that the output will be kept. In other words, the fact that \(f_{t}\) is close to 1 means that from the cell state's point of view, it is influenced by the long-term memory of the past. This can be interpreted as maintaining the gradient for a long-term depending on the time step. The input gate determines the information to be updated in the cell state and is shown in Equation (5) below. The layer then takes the activation function hyperbolic tangent to generate the value \(\widetilde{C}_{t}\) to add to the cell state (see Equation (6)). \[i_{t}=\sigma\Big{(}W_{t}\cdot[h_{t-1},\ x_{t}]+b_{f}\Big{)} \tag{5}\]  
\[\widetilde{C}_{t}=tanh(W_{C}\cdot[h_{t-1},\ x_{t}]+b_{C}) \tag{6}\]  
Equation (7) generates a new cell state \(C_{t}\). \(\widetilde{C}_{t-1}\) is updated by multiplying the old state by \(f_{t}\), then adding \(i_{t}\) and \(\widetilde{C}_{t}\). After performing the element-wise product, a new cell \(C_{t}\) is created, which will be delivered to the next time step. \[C_{t}=f_{t}*C_{t-1}+i_{t}*\widetilde{C}_{t} \tag{7}\]  
Equations (8) and (9) show the role of the output gate, the output value of the sigmoid layer \(o_{t}\), and the updated cell state value \(C_{t}\). The element-wise product is run to generate the output value of \(h_{t}\), which is the value taken by the hyperbolic tangent function on \(C_{t}\). \[o_{t}=\sigma(W_{o}\cdot[h_{t-1},\ x_{t}]+b_{o}) \tag{8}\]  
\[h_{t}=o_{t}*tanh(C_{t}) \tag{9}\]  
This paragraph describes important items and parameters for the experiments and verification using the EMG bio-signals-based LSTM model.