## 3 DeepPrevention Overview
### DeepPrevention Architecture  
DeepPrevention is composed of a prediction module and an explanation module to develop an explainable prediction model, as shown in Figure 2. The DeepPrevention prediction module built on a deep RNN [40] captures the features of time-series NHIS medical checkup data that formed this study's data set. At each time step, the model read each chronic gastritis patients' annual checkup data and returned a prediction of progression to gastric cancer. We set a predicted value of 80% or more as the likelihood that a patient would have developed gastric cancer (Figure 2, left panel). Then, to explain the prediction results, we performed a statistical analysis of patients with high potential to develop gastric cancer based on the 80% cutoff (Figure 2, center panel); we first used the Chi-squared statistics [41] to detect the features that influenced the classification of gastric cancer and atrophic gastritis and then used K-means clustering [42] to identify patients at higher risk. Finally, we generated a personal explanation of a prediction (Figure 2, right panel).  
The proposed prediction model is a deep neural network model with eight hidden layers. We arrived at the appropriate number of layers by increasing the number in each experiment. Table 1 shows the experimental results. For the evaluations, we selected sensitivity given by Equation (1), specificity given by Equation (2), and AUC [43; 44; 45] which is the probability that a classifier would rank a randomly chosen positive instance higher than it ranked a randomly chosen negative one. Algorithm 2 describes DeepPrevention in detail.  
```
Input:X:3D tensor patient data Output:A1: a set of gastritis patients predicted to develop into gastric cancer patients A2: a set of patients predicted to remain as gastritis patients B: features affecting prediction C: a group of patients at high risk D: visualization of personal explanation // STEP 1 predicting patients as gastritis patients and gastric cancer patients Split X into training data trainX and test data testX Learn trainX by deep recurrent neural network Create a prediction model \(M\) with optimized parameters Predict the probability \(p\) of progression with testX using \(M\) for id in personID: if\(p\geq 0.8\)then A1 \(\leftarrow\) id else A2 \(\leftarrow\) id endif endfor ReturnA1, A2 // STEP 2 Chi-squared test to detect influential risk factors ReadA1, A2 Create contingency tables for categorical variables Calculate Chi-squared values and \(p\)-values for each categorical variable for\(pv\) in \(p\)-values if\(pv<0.05\)then B \(\leftarrow\) variable of \(pv\) ReturnB //STEP 3 K-means clustering to identify a group of patients at high risk ReadA1  Decide\(K\), which is the optimal number of groups using the elbow method Apply K-means clustering algorithm into A1 using the \(K\) C \(\leftarrow\) id in personID belonging to high-risk group ReturnC //STEP 4 LIME to show the personal explanation of a prediction Read prediction model \(M\), A1 Perform personal explanation of a patient using \(M\) D \(\leftarrow\) Visualization of the personal explanation ReturnD
```  
**Algorithm 2** Pseudo code of DeepPrevention