Differentiation between Epileptic and Psychogenic Nonepileptic Seizures in Electroencephalogram Using Wavelets and Support-Vector Machines

ABSTRACT The number of people suffering from epilepsy in the world exceeds 50 million and around 20% of this group refers to patients who have psychogenic nonepileptic seizures (PNES). Unlike epilepsy, PNES requires psychological treatment. When not correctly diagnosed, these patients can be submitted to a treatment based on antiepileptic drugs besides specific procedures for epilepsy. In this work, we propose the identification of patients with PNES from those with epilepsy using electroencephalogram (EEG) signals. Discrete Wavelet Transform (DWT) decomposition and a Support-Vector Machine (SVM) classifier were employed. Common types of wavelet families and SVM kernels were combined and compared. The results obtained for accuracy, sensitivity, and specificity are equal to 100% for the set of configuration parameters composed of windows encompassing whole seizures, wavelet Coiflet 1, and SVM kernel sigmoid or RBF. The proposed method is efficient and feasible to be applied to new patients admitted in a hospital center, even without having their previous EEG signals already collected. The main advantages of the proposed work are not requiring the use of accelerometer nor electromyographic signals, not being patient specific and outperforming other works results.


Introduction
According to the World Health Organization, it is estimated that the number of people suffering from epilepsy in the world exceeds 50 million (World Health Organization 2020). Santos et al. (2014) affirm that around 20% of this group refers to patients who have the so-called psychogenic nonepileptic seizures (PNES). Unlike epilepsy, PNES is of psychogenic nature and requires psychological treatment. When not correctly diagnosed, these patients can be submitted to a common treatment based on antiepileptic drugs besides specific procedures for epilepsy.
Based on the previously presented scenario and the negative impact caused to the PNES patient who receives a wrong diagnosis, there are many studies attempting to distinguish between epileptic seizures (ES) and PNES. Bolen, Koontz, and Pritchard (2016) tried to show the difference in Magnetic Resonance Imaging (MRI) images between epilepsy patients with temporal focal lesion and patients with PNES with multifocal lesions. This multifocal nature may explain the higher probability of psychiatric comorbidities in PNES patients. Kerr et al. (2017) used review-of-systems questionnaires (RoSQs) and multivariate logistic regression as an early screening tool to differentiate PNES from other seizure types. Although patients with PNES reported more than twice as many symptoms than the other studied groups, the accuracy of the method was not significantly high. Asadi-Pooya, Tinker, and Fletman (2017) classified PNES seizures based on the video-EEG monitoring in order to investigate the seizure variability. Four classes were distinguished based mainly on the motor response of the patient, and some of them still presented seizures with more than one class. Since the variability increases with the number of classes the authors concluded that neither the stereotypy nor the variability of PNES can or should be used as a marker of the disease and to differentiate PNES from epilepsy.
In the previous examples, the accuracy of the methods was the main bottleneck in the differentiation of the groups. In order to improve these analyses and considering the advance of technology, machine learning has been applied as a more reliable tool (Obermeyer and Emanuel 2016). For example, when combined with EEG signal decomposition techniques, such as the Wavelet Transform (Mallat 1989), it is possible to detect or even predict epileptic seizures as can be observed in the works Rosado and Rosa (2016); Satapathy, Jagadev, and Dehuri (2017); Kitano et al. (2018); Qaraqe et al. (2016).
In the literature, there are several published works about detecting epileptic seizures in the EEG of a patient, as Tzallas, Tsipouras, andFotiadis (2009), Guo et al. (2010), Yuan et al. (2012), Wang et al. (2015), Hassan and Haque (2015), Bhardwaj et al. (2016), Hassan, Siuly, and Zhang (2016), Upadhyay, Padhy, and Kankar (2016), Hassan and Subasi (2016), Kabir, Zhang, and Zhang (2016), Vidyaratne and Iftekharuddin (2017), Achilles et al. (2018), Subasi, Kevric, and Canbaz (2019), Tian et al. (2019), Hassan, Subasi, and Zhang (2020) and Siddiqui et al. (2020). It is worth noting that detecting an epileptic seizure is not the same problem as differentiating an epileptic seizure from a PNES. In Figure 1 about epileptic seizures detection, a hypothetical EEG signal from a patient is represented along the time. In it, time windows without seizures are represented in green and epileptic seizures windows in red. A detection system is trained using both types of windows (with and without seizures) and evaluated later, normally using other EEG windows from the same patient. Unlike that, differentiating epileptic seizures from PNES is as depicted in Figure 2 in which there is an EEG signal from an epileptic patient (at the top) and an EEG signal from a PNES patient (at the bottom), who is another person. From both types of EEG signals, only seizures windows are extracted for training. Thus, contrary to the epileptic seizures detection system strategy, this differentiating system is trained using only seizures windows, but from different patients. Then the evaluation phase is performed on EEG signals from new patients not yet known in the training process. So we assume in this work that an epileptic seizures detection system results are not directly comparable to a system aimed to differentiate epileptic seizures from PNES.
In this sense, considering the focus on distinguishing PNES from ES, the number of works using machine learning combined with other techniques has grown in recent decades (Obermeyer and Emanuel 2016). Kusmakar et al.  (2015) collected the signals from 10 different upper muscles using an accelerometer during epilepsy seizures and PNES. Combining those measures and the electromyography (EMG) of the muscles, an algorithm to classify PNES was proposed. The variation coefficients obtained from Discrete Wavelet Transform (DWT) generated the vectors used by the SVM (Support Vector Machine) classifier. An accuracy of 88.57% was achieved. Gubbi et al. (2016) proposed a wearable device with accelerometers to detect and classify PNES. An algorithm based on k-means and SVM using dyadic scale features resulted in accuracies between 60% and 90%. Although Beniczky et al. (2016) affirm that there is a distinction in EMG signals of epileptic and psychogenic seizures, it is important to note that not all seizures present muscular contractions as observed by Asadi-Pooya, Tinker, and Fletman (2017). Therefore, atonic seizures are excluded from the evaluation when EMG signals are used. Gasparini et al. (2018) classified PNES patients from healthy control subjects by using a Deep Learning (DL) Stacked Auto Encoders (SAE) architecture composed of two hidden layers of 50 and 20 neurons. Continuous Wavelet Transform was considered and a comparison with other techniques such as SVM, LDA (Linear Discriminant Analysis), and QDA (Quadratic Discriminant Analysis) was performed, resulting in an accuracy of 86%. Vasta et al. (2018) also compared PNES and healthy individuals through Random Forest (RF) algorithm and biomarkers based on video-EEG which resulted an accuracy of about 75%. Varone et al. (2020) developed a software pipeline using statistical features extracted from the power spectral density of the EEG signals. It should be noted that the purpose of these works was to differentiate PNES from control healthy cases having no seizures whereas our purpose was to differentiate PNES from epileptic cases.
Several papers concentrate on the identification of subclasses of PNES. Magaudda et al. (2016) aimed to the validation of a novel classification for the diagnosis of PNES, dividing the patients into four distinct groups: Hypermotor (H), Akinetic (A), Focal Motor (FM), and with Subjective Symptoms (SS). The classification was performed by epileptologists and psychiatrist based on video-EEG recordings and the seizures were assigned to a given class in 83.6% of the cases. In contrast, the artificial neural network (ANN) classified PNES in 86.7%. Duwicquet et al. (2017) evaluated how reliable are the methods to classify PNES. Through the statistical method of Cohen's Kappa the inter-rater reliability (IRR) of five existing clinical PNES classifications was determined. They concluded that IRR was only moderate and the difficulty was attributed to the analysis of motor signals. Pippa et al. (2016) investigated the use of machine learning for automatic classification of ES and PNES based on multi-channel EEG signals. The signal patterns in the time domain and in the frequency domain were determined and then combined, generating the vectors used in the different machine learning techniques: BayesNet, Random Committee, Random Forest, K-Nearest Neighbors, SMO (Sequential Minimal Optimization). The best result was achieved by BayesNet with accuracy of 96%. In a subsequent work, Pippa et al. (2017) focused on the dimensionality reduction of the EEG data to distinguish PNES from ES. They used three different fusion schemes to combine the information across the channels and concluded that late-integration (LI) scheme with global model was the best, presenting an accuracy of 97%. Ahmadi et al. (2018) studied the use of Imperialist Competitive Algorithm (ICA) to find the most important features extracted from the five sub-bands Wavelet Transform. Different classifiers have been tested and SVM with RBF kernel has achieved the best result with 95% of accuracy. Further on, Ahmadi et al. (2020) presented a work using short-term EEG data, the classification of epilepsy and PNES subjects based on signal, functional network, and EEG microstate features. They concluded that the beta-band and the coverage are the most important features for classification of epilepsy and PNES patients and achieved an accuracy of around 80% when the classification was computed based on the microstate features extracted from the beta-bands. It should be noted that one merit of that work was that it only used seizures free EEG temporal windows, which probably makes the classification problem more difficult than when using windows containing seizures.
It may be noticed that the possibilities for research in this field are vast. Much has been studied but there is still much to be improved. In this work, we propose the identification of patients with PNES from those with epilepsy using only EEG signal DWT decomposition and an SVM classifier. A system based on this strategy would be useful as a tool for a fast diagnosis between these two possibilities. Furthermore, it would be even better if there is no need to have previous known EEG signals of a newly admitted patient. Thus, this would contribute to the proper treatment for this patient.

Method
The experimental data consists of EEG signals in 18 channels, sampled at 200 Hz, bandpass filtered from 0.3 to 35 Hz by the NeuroWorkbench software, collected as Video-EEG signals by an EEG-1200 Diagnostic and Monitoring Platform. The signals came from 12 PNES patients (3 males and 9 females) and 21 epileptic patients (9 males and 12 females) aged from 6 to 57 years old. The number of PNES occurrences in the first group ranged from 1 to 17 per patient and the number of epileptic seizures in the second group ranged from 1 to 29 per patient. All data were collected from spontaneous (not induced) events. These data are presented in detail in Tables 1 and Tables 2. In those tables, the term window refers to the EEG temporal fragmentation to be explained further in this section. Ethical approval for this study was obtained from Local and National Ethics Committee (CAAE:. 49495715.4.0000.0068). Figure 3 presents the classification process steps used in this work. The EEG signals used in this work were encoded in European Data Format (EDF) files. They have been read using the function edfRead in Matlab software. In the signals, seizures periods have been previously identified by a specialist analyzing Video-EEG records.
In the windows assembly step, two alternatives have been explored: windows having fixed one second duration and windows encompassing whole seizures periods. The numbers of available windows in these alternatives are  shown in the last two columns of Tables 1 and Tables 2. The one second duration in the first alternative has been chosen because in EEG epileptic signals, there are spike waves characterized by a pointed peak with a duration of 20-70 ms and sharp waves with a duration of 70-200 ms (Puspita et al. 2017). One second windows are able to encompass them. All these windows were extracted from seizures periods. The next step can be better understood from Figure 4. For the Wavelet vectors assembly, the wavelets families Coiflet 1 and Daubechies 4 have been alternatively employed when the Discrete Wavelet Transform (DWT) (Mallat 1989) has been applied to each channel of each EEG time window assembled in the previous step. The same scheme is used for both one second windows and windows encompassing the whole seizures periods. The choice of these wavelets families is based on the works of Indiradevi et al. (2008) and Gandhi,  Panigrahi, and Anand (2011), who have studied what are the most suitable wavelets families to extract EEG characteristics in this context. The DWT has been performed using Matlab software. For each time window, the corresponding characteristic vector has been assembled receiving the average (μ), standard deviation (σ), maximum (max) and minimum (min) values of the coefficients at each DWT resolution level for all EEG channels. There were coefficients at five detail levels (D 1 to D 5 ) and the approximation coefficients (A 5 ). Each of the parameters μ, σ, max, and min has been calculated from the set containing the coefficients at the same detail level for all channels. This resulted in 24 components for each vector, four components for each wavelet level. The resultant characteristic vectors have then been normalized to have values between À 1 and þ 1.
In the SVM classification step, three alternative kernels have been used: linear, sigmoid, and RBF. The SVM implementation used in this work has been the LIBSVM (Chang and Lin 2011) inside Matlab. Training an SVM consists in solving an optimization problem, in which data examples and their corresponding classes are provided as inputs and an optimal separator between the classes is found as the result (Cortes and Vapnik 1995). Details about the SVM training process as implemented in LIBSBM are explained in Chang and Lin (2011). When training examples are imbalanced (i.e. one class has more examples than the other), the success of the SVM may be compromised (Akbani, Kwek, and Japkowicz 2004). In the present work, although the training data were imbalanced, very good results were obtained without taking any measures to cope with this.
To ensure that the method is not patient specific, test data always comes from patients other than that of the training data. Four groups of experiments were performed, each one partitioning the set of patients into patients for training and patients for test, as can be observed in column training patients in Table 3. All seizures and all 1-s windows of the test patients are used in each corresponding test. Their numbers are also indicated for each partition in the column training patients in Table 3. Table 3 presents the experimental results. The columns represent, in this order: the time windows duration, the patients used in the training (all the others were used in the test), the wavelet type, the SVM kernel employed, the classification accuracy, sensitivity, and specificity. For these last two measures, which require the specification of which samples are positive or negative, the epilepsy seizures and the PNES cases were considered, respectively, as being the positive samples and the negative samples. As can be observed in boldface in Table 3, there is a set of parameters which      consistently achieved 100% accuracy for all the partitions. This set is composed of windows encompassing whole seizures, wavelet Coiflet 1, and SVM kernel sigmoid or RBF.

Results
In Table 4 the results obtained in the present work are compared to that of other works which aimed also to distinguish PNES from epileptic seizures. The columns represent, in this order: the research work, the techniques used there, the accuracy, the sensitivity, the specificity, the number of PNES examples, and the number of epilepsy examples.
Experiments have also been performed by assembling the vectors directly from the samples in the time domain, without using the Wavelet transform. In these experiments, the vectors features have been the samples averages, standard deviations, maximum and minimum values per channel per window. Their results have been inferior to that obtained using DWT and have not been explored further. The same happened with the experiments based on the SVM classifier with polynomial kernel.

Discussion
Machine learning techniques have been applied to different aspects of epilepsy treatment. These techniques are especially valuable for processing brain signals due to the ability of their computational algorithms to deal with noisy conditions (Acharya, Hagiwara, and Adeli 2018). Employing of machine learning to classify between PNES and ES can potentially improve the quality of life of PNES patients, since they are frequently treated with multiple drugs, causing delays in appropriate treatment (Bruni et al. 2017). The utilization of video-EEG (gold-standard diagnostic for PNES) is expensive, because it requires hospitalization, and moreover, it is unavailable in many hospital centers (Vasta et al. 2018). The use of machine learning can, thus, alleviate these issues, as well as help physicians to diagnose PNES. In the present work, we applied a machine learning technique called SVM to differentiate patients with PNES from those with ES. To improve the differentiation between both classes, three types of SVM kernels were studied: linear, RBF, and sigmoid. Polynomial kernel was also tried but with unsatisfactory results. Other published studies have also employed SVM for identifying PNES, however there are crucial differences concerning the input signals applied to the classifier. For example: Gubbi et al. (2016) used, as input, measures from accelerometers arrangement on patient muscles; Kusmakar et al. (2015) utilized similar accelerometer signals combined with EMG measures; Ahmadi et al. (2018) applied ICA to extract the features from EEG signals in sub-bands of its wavelet transform. Later, Ahmadi et al. (2020) studied the EEG microstates and the functional brain neural network in several classifiers. None of these studies reached an accuracy greater than 95% in the PNES identification. In this work, we employed DWT decomposition of the EEG signals with Coiflet 1 and Daubechies 4 families as inputs to the SVM classifier. Gasparini et al. (2018) also applied wavelet transform to extract features from EEG signals and reached an accuracy of 86% using Mexican hat as the mother wavelet. The literature survey performed shows that the best overall accuracy to differentiate PNES from ES was 97% (Pippa et al. 2017).
In Table 3, the results obtained for accuracy, sensitivity, and specificity are equal to 100% for the set of configuration parameters composed of windows encompassing whole seizures, wavelet Coiflet 1, and SVM kernel sigmoid or RBF. For the 1-sec windows group the results were also satisfactory, varying from 95% to 100%, depending on the wavelet type and SVM kernel.
In order to analyze the statistical reliability of the results presented, after having obtained them, their statistical relevance must be calculated. Normally, in binary classification problems, the results are presented also in the form of confusion matrices or in the form of ROC curves. But after comparing the different system configurations presented in Table 3, we concluded that the ideal configuration is that which uses windows encompassing whole seizures, Coiflet 1 wavelet in the extraction step and RBF or sigmoid kernel in the SVM. Therefore, for an ensuing practical application, this ideal configuration may be adopted and the others abandoned. And as indicated in Table 3 (lines in boldface), for this ideal configuration, the accuracy, the sensitivity, and the specificity are always equal to 100%. In this scenario, confusion matrices and ROC curves become trivial, not bringing any additional information. But according to the law of large numbers (Papoulis 1991), it is possible to calculate a margin to the accuracy results obtained here as a function of the number of test samples used in the experiments. That law states that P jx n À pj < ε f g � 1 À 1 4nε 2 À ! n!1

1
(1) where x n is an estimated parameter mean obtained from a sample containing n elements of a population, p is the true parameter mean (from the whole population) and ε is a margin to the estimation. In this work, we attempt to estimate the true classifier accuracy using a limited set of test examples. Thus, the parameter x whose mean is being estimated is the success (equal to 1) or the failure (equal to 0) of the classifier when trying to determine if a test sample corresponds to an epileptic seizure or to a PNES, so x n is here the reported accuracy for each experiment performed on n test examples. Among the four partitions used in the experiments, the second one in Table 3 is that which used more seizures as test examples, n ¼ 31 þ 78 ¼ 109 seizures. So statistically the results for this partition are the most conclusive. Adopting ε ¼ 0:1 in (1), one obtains P jx n À pj < 0:1 f g � 1 À 1 4 � 109 � 0:1 2 � 77% which means that the probability that the estimated accuracy is within � 10% from its true value is greater than 77%. Repeating this calculation using ε ¼ 0:07, one obtains the result that the probability that the estimated accuracy is within � 7% from its true value is greater than 53%.
Focusing attention now on the experiments using 1-s windows, still in the second partition, the number of test examples is n ¼ 1819 þ 4868 ¼ 6687 1-s windows. Now, for ε ¼ 0:1, one obtains the result that the probability that the estimated accuracy is within � 10% from its true value is greater than 99%. Narrowing ε to 0.01, one verifies that the probability that the estimated accuracy is within � 1% from its true value is greater than 62%. So although the results obtained using windows encompassing the whole seizures are apparently superior to that using 1-s windows, the latter are statistically more reliable due to the availability of much more test examples.
In this sense, it is important to consider that, whatever system is implemented, it is capable of being constantly updated with new data obtained from new patients, always improving its performance.
Unlike other studies related with epilepsy, our proposal is not patient specific. This means that our system may be applied to new patients admitted in a hospital center, even without having their previous EEG signals already collected. Thus, as can be seen, the present work has the advantages of not requiring the use of accelerometer nor electromyographic signals, not being patient specific, and also presenting very good results.

Disclosure Statement
No potential conflict of interest was reported by the author(s).