## 2 Materials and Methods
### Performance Evaluation  
In the experiment, the prediction effect was achieved by learning and classifying the EEG data characteristics of preictal and interictal segments. In order to evaluate the prediction effect of the prediction system, we introduce some performance evaluation indexes. In this paper, _Accuracy, Sensitivity, Specificity, Precision, Recall_, and \(F1\)-_Score_ are used as the evaluation indexes for the model. The calculation formulae are as follows:  
\[Accuracy=\frac{TP+TN}{TP+FP+TN+FN}, \tag{7}\]  
\[Sensitivity=Recall=\frac{TP}{TP+FN}, \tag{8}\]  
\[Specificity=\frac{TN}{TN+FP}, \tag{9}\]  
\[Precision=\frac{TP}{TP+FP}, \tag{10}\]  
\[F1-score=\frac{2\times Recall\times Precision}{Recall+Precision}, \tag{11}\]  
where the true positive (_TP_) and true negative (_TN_) are correctly classified as preictal and interictal EEG segments, respectively. False positives (_FP_) and false negatives (_FN_) indicated that they were incorrectly predicted as preictal and interictal EEG segments. In real life, however, it is necessary to warn patients and doctors in advance of the impending seizure, so that the medical doctors can be prepared to properly manage the episode. In order to evaluate the performance of the seizure prediction model, we introduced seizure prediction horizon (SPH) and seizure occurrence period (SOP). SOP is defined as the time-period for predicting seizures, while SPH refers to the time-period from the alarm to the beginning of SOP, that is, the period of clinical intervention. The successful prediction of epilepsy means that seizures must occur after SPH and during SOP (Figure 2). If there is a seizure during SPH or no seizure in SOP, it is considered a false alarm. In clinical use, the SOP should not be set too long, otherwise it will increase the anxiety of patients and cause mental stress. The setting of SPH should provide doctors with enough time for clinical interventions [38]. In order to define an appropriate period for SPH and SOP, researchers have studied both. According to the survey in [39], the optimal warning time is 3-5 min. Therefore, we considered setting the SPH to 3-5 min. [PERSON] [40] proposed that SPH + SOP should be more than 10 min and less than 90 min to provide treatment for patients and avoid undesirable anxiety. Furthermore, the SOP in many seizure prediction studies [12; 38; 41] is generally 30 min. Based on the above considerations, SPH and SOP in this paper are set to 3 min and 30 min, respectively, that is, when the model gives a correct alarm, the patient's seizure should occur between 3 min and 33 min later. However, the SOP and SPH are usually unknown clinically, and researchers usually chose values based on assumptions [41]. Studies have shown that the electrical changes that occur in the brain before seizures are difficult to capture with the human eye [42]. Furthermore, due to the specificity of seizures, the length of the pre-onset period will vary from a few minutes to a few hours [43]. This may cause our hypothesis for pre-seizure to deviate from the ground truth, resulting in the wrong label for individual EEG segments that do not have the characteristics of typical pre-seizure, thus affecting the accuracy of the prediction results. The model we proposed is primarily designed to distinguish between preictal and interictal EEG segments, where sporadic false positives during interictal periods are common and false alarms will appear. The false positive rate (FPR), defined as the number of false alarms per hour, is an important index for evaluating the prediction of seizures. In order to reduce the false-positive rate, we further post-processed the classification results of the model. In this paper, we adopt the k-of-n method put forward by [12] to post-process the seizure prediction task.