## 2 Materials and Methods
### Methods  
We used a 3D fixed time format to input serial data into the model. For the serial data modeling, a recurrent neural network (RNN) managed the data using a circular network model. Simple RNNs have a vanishing gradient problem, which cannot generate proper gradient values from repeated activation functions. The gradient value is an operator that directs the RNN's learning. The activation function calculates the gradient value for each iteration and will produce a value close to 0 after circular network executions. In contrast, long short-term memory (LSTM) uses a gating method to adjust the signal, which eliminates the vanishing gradient problem (see Figure 2). The input vector adjusts the value based on the tanh activation function. The forget vector adjust part of the previous input value to the current input. The output vector adjusts the output values using the previous input and current adjusted input. After all of these gating methods, the final output is used as the next input for the tanh and sigmoid layers. Typically, the clinical event observations were not collected regularly. This irregular sampling meant that the intervals between consecutive events were not evenly spaced. LSTM cannot learn effectively from such data. Phased-LSTM selectively updates the status to account for irregular sampling times through an additional time gate [14]. At each time step, the time gate switches on and off to update the state and  
Figure 1: Irregularly collected events observations (top) 3D format input for serial data model (bottom). the hidden output state. These updates only happen for the open phase. Otherwise, the previous values will be used. The time gate addresses the LSTM problems caused by irregularly sampled data (see Figure 3). There are two patterns of serial medical data: in the first, more than two features are sampled simultaneously and, in the second, some parts of the features are missing and others are not. To manage both patterns, missing imputation must be applied. The phased-LSTM's time gate addresses these patterns based on three phases (see Figure 4). The time gate of phased-LSTM \(k_{t}\) has three phases: phase 1, \"openness-rise\" 0 to 1, phase 2, \"openness-drop\" 1 to 0, and phase 3, \"closed\" a leak at a rate \(\alpha\)[14]. Figure 3: Phased LSTM using rectified linear units as the time-gate kt that propagates the gradient well. Figure 2: Standard long short-term memory (LSTM) using three gates (forget, input, and output) to eliminate the vanishing gradient problem. The time gate \(k_{t}\) is described by  
\[\phi_{t}=\frac{(t-s)mod\ \tau}{\tau} \tag{1}\]  
and  
\[k_{t}\left\{ \begin{array}{ll}\frac{2\phi_{t}}{r_{m}},&if\ \phi_{t}<\frac{1}{ 2}r_{m}\\ 2-\frac{2\phi_{t}}{r_{m}},&if\ \frac{1}{2}r_{m}<\phi_{t}<r_{m}\\ \alpha\phi_{t},&otherwise\end{array} \right. \tag{2}\]  
In this case, \(\phi_{t}\) is an auxiliary variable that represents the phase of the cycle (Equation (1)), \(t\) is the time point, \(s\) is the phase shift, \(\tau\) is the period that controls the real-time period, and \(r_{m}\) is the ratio of the open period to the total period \(\tau\)[14]. Phased-LSTM's time gate \(k_{t}\) is a kind of rectified linear unit that can propagate gradient information effectively [14] (Equation (2)). Thus, \(k_{t}\) has three parameters: \(\tau\), \(s\), and \(r_{m}\). These parameters were used during the phased-LSTM model learning. During the open-phase, the rise or drop period in Figure 4 known as propagates new cell states or \(a\)-weighted gradient information. Ultimately, \(k_{t}\) is able to propagate irregularly sampled data selectively. In other words, it deals with complicated time series medical data effectively. [PERSON] et al. presented this algorithm, which outperforms previous LSTM algorithms [14]. We used a chi-squared test to find the characteristic of patients' data. The chi-squared result showed the information of group differences, which represent how each of the groups performed in the study [20].