## 5 Stroke Prediction Model
### Model Optimization  
For a classifier, the discrimination threshold is usually set to 0.5. If the outputted probability is larger than 0.5, the subject should be classified as a positive case, otherwise it should be labeled as a negative case. Undoubtedly, misclassification would lead to certain loss to the subjects. As for ischemia prediction, it will incur severe consequences if we classify a subject who is about to suffer from stroke as a healthy person. Thus, we should keep the false negative rate of the classification model as low as possible. At the same time, slight increase in the false positive rate of the classification model will not result in serious consequences. Therefore, we propose a pre-selection model to optimize the proposed stroke prediction model, in order to keep the false negative rate relatively low with the false positive rate not significantly increased.  
In this paper, two different training datasets are utilized to optimize the model. Concretely, the first dataset is comprised of stroke patients (denoted as PartS) who suffered from stroke before and after the time of the SHHS-1 study. The second dataset consists of healthy subjects (denoted as PartH) who had no stroke throughout the whole data acquisition process. Next, based on the aforementioned two datasets, we construct a pre-selection model to determine which kind of threshold, i.e., a normal threshold or an adaptive threshold, should be employed when classifying each instance. In particular, we choose to use the k-NN classification algorithm to build the pre-selection model which classifies instances based on their k-closest neighbors' labels. Specifically, for each data instance, we first compute the distance between itself and all the instances in PartH and PartS, and then select the top-k nearest neighbors accordingly; if the ratio of instances from PartS is larger than a given threshold, we do have reason to believe that the instance is likely to suffer from stroke soon. Therefore, to make the classification model more sensitive to this kind of instance, an adaptive threshold smaller than 0.5 should be used. For other instances, we still use a normal threshold, i.e., 0.5. For example, if subject i's probability generated by the first phase model is smaller than 0.5, they would be classified to health person. However, in the pre-selection model, the ith instance is much closer to PartS, so we should reduce the threshold in order to classify it into potential stroke patients. Figure 5 shows the core idea of our KNN-based pre-selection model, where the k is set to 7, 11 and 15, respectively.  
The details of the proposed model are described in Algorithm 1. Particularly, if a person is closer to PartS, we will reduce the threshold to a new threshold t that is smaller than 0.5 accordingly. If the output of the model is greater than the new threshold t, we will classify the subjects into the Stroke class, instead of the Healthy class. Specifically, the cosine distance is used in the KNN model, which is in line with the general experience.  
```
0:\(p_{i}\): subject i's probability distribution
0:\(n\_test\): a number of subjects in the testing dataset
0:\(t\): the prediction threshold
0: subject\({}_{i}\): the \(i\)-th subject in the testing dataset
0:prediction result of the instance: 0 or 1
1: select a portion of data from each PartS and PartH;
2:for\(i=0\); \(i<n\_test\); \(i++\)do
3: calculate the distance between \(i\) and samples in PartS and PartH;
4: arrange results in ascending order;
5: dataset\(\_\)k \(\leftarrow\) the top k closest samples;
6:if sizeof(dataset\(\_\)k \(\cap\) PartS) \(>\) k/2 and \(p_{i}\geq t\)then
7: label subject i as 1 (denotes ischemia);
8:else
9:if\(p_{i}\geq 0.5\)then
10: label subject i as 1 (denotes ischemia);
11:else
12: label subject i as 0 (denotes health);
13:endif
14:endif
15:endfor
```  
**Algorithm 1** Pre-selection Model based on KNN.  
Figure 5: A pre-selection model based on kNN.