## 3 Experiment and Results
### Analysis and Experimental Results on Network Stability  
The principle of training GANs is to make the generator and discriminator compete with each other until they reach a balance. When initially training WGAN-GP, the discriminator converged quickly, making it difficult for the generator to learn enough to generate high-quality STFT samples. This resulted in a simple classification of real and fake samples. To overcome this problem, we updated the generator twice and set up an early stopping monitor to track the loss values of the generator and discriminator. If the value of \(\mathrm{D_{loss}}\) is greater than \(\mathrm{G_{loss}}\) for K consecutive training batches, we stop training WGAN-GP. In this study, we set K = 20, batch size = 64, and the number of training iterations = 10. We also used an Adam optimizer with a learning rate of 1 \(\times\) 10\({}^{-4}\), \(\lambda\) = 10, \(\beta\)1 = 0.5, \(\beta\)2 = 0.99, and \(\varepsilon\) = 1 \(\times\) 10\({}^{-8}\) to optimize the model's gradients. The training process did not provide any labels for pre-ictal or inter-ictal periods to the network, so the network underwent unsupervised training for epileptic seizure detection. By visualizing the loss values, we can verify the effects of updating the generator twice. In Figure 10, we plot the initial and updated loss values of the generator and discriminator, using patient 1 from the CHB-MIT dataset as an example. From the graph, we can observe that the updated \(\mathrm{G_{loss}}\) value is lower, and the fluctuations are significantly reduced. This means that the generated STFT samples are closer to the original samples, and a better discriminator helps improve its discriminatory performance. The generator and discriminator reached a balance after approximately 1500 steps, at which point the monitor stopped training. The stability of GAN training is closely related to the variations of \(\mathrm{D_{loss}}\) and \(\mathrm{G_{loss}}\) and their corresponding gradient changes [33]. Therefore, on the premise of performing STFT preprocessing on the EEG signals, the stability of network iteration training for DCGAN and WGAN-GP generators and discriminators is compared. Figure 11 shows the convergence of \(\mathrm{D_{loss}}\) and \(\mathrm{G_{loss}}\) after training with two different models on patient 20. Comparing the two, it can be observed that the loss function curve of WGAN-GP has a  
Figure 10: Changes in the original loss function and the updated loss function. much smaller oscillation amplitude than DCGAN, and its gradient change trend is also smoother than DCGAN. Tables 1 and 2 provide a comparison of the sensitivity and AUC values for the selected semi-supervised learning method WGAN-GP, the fully supervised learning method CNN, and the semi-supervised learning method DCGAN. From the data in columns 2-4 of Tables 1 and 2, it can be observed that the WGAN-GP semi-supervised learning method has a 3.19% lower sensitivity compared to the fully supervised learning method. However, it is worth mentioning that WGAN-GP shows a 1.88% improvement in AUC compared to the fully supervised method (CNN). Under the same data preprocessing and model parameter settings, the WGAN-GP semi-supervised method has an average improvement of 9.8% in sensitivity and 13.14% in AUC compared to DCGAN. To ensure the stability of the classifier training and accelerate convergence, batch normalization is applied at each layer of the network, and the network parameters for high-order feature learning are fixed. To prevent overfitting, the dropout rate for the subsequent two layers of the neural network is set to 0.3. Moreover, 75% of the pre-seizure and inter-seizure samples in the training dataset are used as the training set, while 25% are used as the validation set. To evaluate the performance of the Bi-LSTM as a classifier, we compare it with the WGAN-GP model, which uses fully connected layers for classification.