# An Efficient Hybrid Model for Patient-Independent Seizure Prediction Using Deep Learning
## 2 Materials and Methods
### EEG Signal Pre-Processing  
The pre-processing step's goal here is to remove noise from the EEG signal in order to get more accurate features and results. Many studies have discussed different noise removal techniques, and one of the most effective methods is discrete wavelet de-noising schema. Wavelet de-noising is effective in de-noising physiological signals because it has the tendency to preserve signal properties while reducing noise; this is preferred and frequently used over signal frequency domain filtering. The reason for this is that threshold  
Figure 1: Sample of CHB-MIT dataset represented by parallel readings from electrodes placed on a patient’s scalp. Figure 2: Proposed model architecture, consisting of a pre-processing module followed by an EEG signal segmentation phase and a deep learning phase. strategies are available that allow reconstruction based on chosen coefficients. It has also been proven in recent years that the following sets of wavelets are effective for cleaning signals: ['Daub4', 'Daub6', 'Daub8', 'Daub12', 'DMeyer', 'Symlet9']. In this paper, the latter ones were applied to choose the best de-noising technique for every EEG channel. The dataset signals were further subdivided into individual channels. Each of these channels was then fed into the noise removal module as an input. This module included six major wavelets, which were as follows: ['Daub4', 'Daub6', 'Daub8', 'Daub12', 'DMeyer', 'Symlet9']. The 'denoise_wavelet' method from the Python library'skimage' was used for each of the wavelets, with wavelet levels = 4. The wavelet domain is a sparse representation of the signal, similar to the frequency domain of the Fourier transform. Sparse representations have primarily values of zero or near-zero and truly random noise is represented by many small values in the wavelet domain. Setting all values below a certain threshold helps to reduce signal noise. A de-noising procedure is usually divided into three steps. First, a wavelet and a N level are selected. The wavelet decomposition of signal s at level N is then computed. In the case of this study, N was set to 4, and we had a list of several wavelets, as previously mentioned. Figure 3a depicts the decomposition of a signal into different levels using low pass and high pass filters. Second, a threshold was chosen for each level, from 1 to N, and soft thresholding was applied to the detail coefficients. Finally, wavelet reconstruction was computed using the original approximation coefficients of level N and the modified detail coefficients of levels 1-N.  
For each channel, the best wavelet was chosen according to the least root mean square error (RMSE) and the highest signal-to-noise ratio (SNR). SNR is defined as the ratio between the power of the signal and the power of the noise; this ratio must be maximized to reach a better and cleaner signal. While RMSE is the standard deviation of the residual (difference between the original signal and cleaned signal), it is used frequently in forecasting and regression analyses to verify experimental results. RMSE and SNR have been widely used as criteria to choose the most effective wavelet for a cleaned signal. Table 1 shows examples of different SNR and RMSE values for a channel of an EEG signal from patient one. Based on the experimental results, channel 'db12' had the highest SNR and the lowest RMSE, so it was chosen as the best wavelet for noise removal in this channel. Figure 3: (**a**) Decomposition of signal using DWT with different levels. (**b**) Large scale and (**c**) small scale. (**b**,**c**) Illustrates the effect of noise cleaning, where the blue signal is the signal before removing noise and the orange signal is the signal after applying the most suitable de-noising technique, according to RMSE and SNR. In order to prove the robustness of the system and the effectiveness of the noise removal module, artificial noise, such as Gaussian noise, was added to the signal at different percentages.