{'fraction_non_alphanumeric': 0.04090898229348371, 'fraction_numerical': 0.014910750555568831, 'mean_word_length': 4.770821842250414, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Detection of Epileptic Seizures on EEG Signals Using ANFIS Classifier, Autoencoders and Fuzzy Entropies

Epileptic seizures are one of the most crucial neurological disorders, and their early diagnosis will help the clinicians to provide accurate treatment for the patients. The electroencephalogram (EEG) signals are widely used for epileptic seizures detection, which provides specialists with substantial information about the functioning of the brain. In this paper, a novel diagnostic procedure using fuzzy theory and deep learning techniques is introduced. The proposed method is evaluated on the Bonn University dataset with six classification combinations and also on the Freiburg dataset. The tunable-Q wavelet transform (TQWT) is employed to decompose the EEG signals into different sub-bands. In the feature extraction step, 13 different fuzzy entropies are calculated from different sub-bands of TQWT, and their computational complexities are calculated to help researchers choose the best set for various tasks. In the following, an autoencoder (AE) with six layers is employed for dimensionality reduction. Finally, the standard adaptive neuro-fuzzy inference system (ANFIS), and also its variants with grasshopper optimization algorithm (ANFIS-GOA), particle swarm optimization (ANFIS-PSO), and breeding swarm optimization (ANFIS-BS) methods are used for classification. Using our proposed method, ANFIS-BS method has obtained an accuracy of 99.74% in classifying into two classes and an accuracy of 99.46% in ternary classification on the Bonn dataset and 99.28% on the Freiburg dataset, reaching state-of-the-art performances on both of them.

E PILEPSY is a group of neurological disorders associated with seizures [1], [2]. Epileptic seizures result from the abnormal activity in the cortex of the brain, presented in two types of focal and general seizures [3], [4]. Seizures can cause various symptoms such as sudden loss of consciousness, muscle contraction, and emotional or behavioral changes in the patient [5], [6]. Based on statistics published by the world health organization (WHO), more than 50 million people on the planet suffer the burden of epilepsy, shaping around one percent of the world population [7].
Neuroimaging modalities are among the essential techniques for epileptic seizures detection, including functional and structural methods [8], [9].
The EEG signals carry vital physiological and pathological information in their recordings [10]. Various neurological disorders such as epileptic seizures [11] and autism spectrum disorder (ASD) [12] can be diagnosed using EEG signals, owing to its high temporal resolution, portability, and inexpensiveness. Epileptic seizures are detected currently by clinicians by visual inspection, which is subjective and timeconsuming. The presence of myogenic and ocular artifacts makes the detection process a challenging task [13]. The computer aided diagnosis system (CADS) can be employed for the diagnosis of epileptic seizures. The CADS helps clinicians to identify epileptic seizures automatically [14]. These systems are faster, more accurate, and also can handle a huge volume of data. The CADS has four steps for automated diagnosis of epileptic seizures. These steps contain pre-processing, features extraction, feature selection/dimensionality reduction, and classification [1], [3], [4], [5], [6], [15].
So far, many pieces of research have been conducted on creating CADS suitable for epileptic seizures detection on EEG signals, mostly focusing on increasing these systems' accuracy and performance. In this paper, a novel method is presented for epileptic seizure detection on EEG signals based on fuzzy logic theories and deep learning; Figure 1 shows the steps of the proposed system. As shown in Figure 1, the Bonn and the Freiburg datasets were used for the implementation and evaluation of the proposed method. The Bonn dataset contains various classification problems.
The second part of the proposed CADS is dedicated to preprocessing EEG signals of both datasets using TQWT. In this stage, the TQWT [16] is used to decompose the EEG signals of the Bonn [17] and Freiburg [18] datasets into different sub-bands. TQWT, first introduced in [16], is an improved version of DWT, suitable for preprocessing of chaotic biomedical signals such as EEG. Redundancy or oversampling rate (r), number of sub-bands (J), and Q factor (Q) are the most critical parameters of this wavelet transform. In our paper, parameters are chosen as J = 8, r = 1, and Q = 3, similar to [19].
Considering that EEG signals have chaotic behavior, nonlinear feature extraction techniques can help CADS reach higher performances. Feature extraction is of utmost importance in steps of CADS for epileptic seizure detection. Previous studies have shown that non-linear features perform better in this task, given the chaotic characteristics of EEG signals [20]. Among them, fractal dimension (FD) techniques [21], correlation [22], largest Lyapunov exponent (LLE) [23], and also various types of entropies [20].
In this paper, a combination of fuzzy entropies is employed for feature extraction. Employing fuzzy entropies for epileptic seizure detection has been examined very limited in previous studies, all of which are reviewed in the following.
Xing et al. [24] proposed a method for epileptic seizure detection based on fuzzy entropy (FuEn). They used FuEn for feature extraction and support vector machine (SVM) for classification and achieved promising results. In [25], first, EEG signals were segmented into various time-windows. In the following, power spectral density (PSD) and FuEn were computed for signals as features; lastly, SVM was applied for classification, and an accuracy of 96.20% is reached at best. Tripathi et al. [26] employed empirical mode decomposition (EMD) in preprocessing step for the decomposition of signals into different sub-bands; then, they used FuEn and SVM for feature extraction and classification, respectively, and reported a 97% accuracy. In [27], the authors introduced a novel entropy named fuzzy distribution entropy (FuDistEn). Then, an epileptic seizures detection method is presented that consists of wavelet packet decomposition (WPD), FuDistEn, and Kruskal-Wallis nonparametric one-way analysis of variance. In their system, FuDistEn values are computed from all nodes in every level and fed to k nearest neighbors (KNN) classifier as features.
An epileptic seizure detection method based on fuzzy permutation entropy (FuPeEn) was introduced in [28]. In this work, an artificial neural network (ANN) is employed for classification, and an accuracy of 98.72% is achieved. Similarly, in [29], FuPeEn has been picked for the same task. Here, after preprocessing the input signals, researchers have extracted FuPeEn from each frame and fed them to various classification methods for comparison. Averagely, they reach an accuracy of 98.72%. In another research, Kumar et al. [30] applied fuzzy approximate entropy (FuApEn) for epileptic seizure detection. They first preprocessed signals using discrete wavelet transform (DWT), and after feature extraction, they used an SVM for classification, reporting an accuracy of 97.83%. Bhattacharyya et al. [31] employed TQWT and multivariate Fuzzy Entropy for preprocessing and feature extraction, respectively. Fractional fourier transformwavelet packed transform (FFTWPT) was used by Li et al. [32] in preprocessing step of their method. Then, FuEn was used for feature extraction. By using principal component analysis (PCA) for dimensionality reduction and SVM for classification, they reached an accuracy of 98.58%.
As demonstrated in Figure 1, the fourth step is dedicated to dimensionality reduction. In this paper, an AE is applied to reduce the feature matrix's dimensionality; the applied AE has a hand-tailored structure for this specific task, which is the second novelty of this paper. Considering the high dimensionality of feature vectors, without dimensionality reduction, the classifier cannot train properly; AE is a wellknown dimensionality reduction that learns a representation in a smaller space. Compared to other dimensionality reduction methods such as PCA [44], AEs are capable of modeling complex non-linear functions, while others are mostly a linear transformation.
The last step of the proposed method is classification; here, KNN, multilayer perceptron (MLP), SVM, random forest (RF), and various ANFIS classification methods are employed for comparison. First, the classification is performed using standard ANFIS [45]; then, to improve the proposed CADS performance, improved ANFIS-GOA, ANFIS-PSO, and ANFIS-BS models are used. Standard ANFIS uses backpropagation to train the model; however, in the improved versions, GOA [46], PSO [47], and BS [48] methods are used to enhance the training process. Using optimizers for training the ANFIS has been studied before by many researchers [49], [50]; however, they have mostly used GA or PSO optimizers. In this work, we have used the BS algorithm to train the ANFIS, which is a combination of GA and PSO, and to the best of our knowledge, this is the first time any research has used this algorithm to train ANFIS. Results show the superiority of the proposed method compared to previous studies.
The organization of the rest of the paper is depicted as follows. The material and methods are described in Section 2, Section 3 is dedicated to the evaluation processes; and finally, Section 4, 5, and 6 present the experiment results, limitations of the study, and discussion, respectively.

II. MATERIAL AND METHODS
A. Dataset 1) Bonn Dataset: This dataset was recorded at the University of Bonn by a group of researchers, and it had been extensively used for research in the area of epileptic seizure analysis and detection [17]. This dataset contains 500 signal frames with a length of 23.6 seconds. In this dataset, the sampling frequency is 173.61 Hz. They consisted of five classes' viz. A, B, C, D, and E with 100 segments recordings in each class [17]. Five healthy controls in the relaxed and awake state with 10-20 standard electrode placement schemes contributed to Class A and B EEG surface data. Intracranial electrodes were used on 5 patients who suffered from epilepsy and collected data of C, D, and E classes [17].
The hemisphere of the epileptogenic zone and the opposite hemisphere were used respectively for the recording of the C and D classes' signals during inter-ictal (seizure-free) period. Ictal (seizure) period was taken into account for the recording of class E [17]. More details about the Bonn dataset are reported in Tables I and III. 2) Freiburg Dataset: The Freiburg dataset [18] includes intracranial electroencephalography (IEEG) signals from 21 patients suffering from focal epileptic seizures recorded at Freiburg Hospital in Germany. All IEEG signals were recorded using a Neurofile NT digital video EEG system with 256 Hz sampling frequency. During recording, depth (d), strip (s), and grid (g) electrodes were applied to reduce noise and increase SNR. In this database, all subjects range in age from 10 to 50 years containing 13 women and 8 men. The database comprises a variety of ictal, pre-ictal, and inter-ictal samples from patients with epileptic seizures. At the time of recording IEEG signals, at least 2 and at most 5 epileptic seizures were observed in each subject. Three different seizure types including generalized tonic-clonic (GTC), complex partial (CP), and simple partial (SP) have been reported among patients and they have experienced at least two different types. Epilepsy was detected in 11 patients in the neocortical brain location, in the hippocampus location in eight patients, and in two patients in both regions. More details on Freiburg dataset are provided in Table II.

B. Preprocessing using TQWT
Wavelet transforms have a wide range of applications in the scope of brain signal processing [51], [52], [53]. TQWT is an improved and particular type of DWT introduced by Ivan Selesnick [16] and is also employed to precisely analyze EEG signals. In the TQWT, the input parameters, r, J, and Q can be tuned [16]. Two channel filter bank operations high pass filter H 1 (ω) with scaling factor γ and ξ low pass filter H 0 (ω) with scaling factor ξ can be used in TQWT. The TQWT expressions are as given below [16]: where λ(ω) = cos 2 ω 2 2 − cos(ω), |ω|≤ π is the Daubechies filter frequency response [16].
High-pass and low-pass scaling factors are selected to satisfy the conditions [16]: The maximum number of sub-bands J max , redundancy r, and quality factor Q and parameters are defined in terms of ξ and γ as [16]: Redundancy r must be greater than 1, and the Q-factor should be chosen such that Q ≤ 1. Figure 2 illustrates the result of applying TQWT on a frame of the Bonn dataset's signals for r = 3, Q = 1, J = 8, respectively. Also, Figure  3 illustrates the frequency response for r = 3, Q = 1, and J = 8.  AB-CD-E Healthy -Interictal -Seizure C. Feature Extraction EEG signals have chaotic behavior. Given that entropies are an important class of feature extraction methods, in this work, different fuzzy entropies have been used to extract the feature from EEG signals, and they are mentioned below.
1) Standard Fuzzy Entropy: For a time series x(i), i = 1,2,...,N FuEn [33] establishes vector sequences X m i , i = 1, ..., N − m + 1 as given blow: Where the length of the sequences is denoted by m, x 0 (i) is a baseline. D m ij (n, r) is the similarity degree using fuzzy membership function µ(d m ij , n, r)) for the vector X m i and X m j replacing the Heaviside function [33]. where r and n are predefined gradient and width of the exponential function, d m ij is the maximum absolute difference between X m i and X m j . φ m function is defined as below [33]: The sequences X m+1 i is generated by setting m ← m+1 and φ m (n, r) is constructed afterwards. Time series for input x(i) for FuEn is generated φ m (n, r) deviated from φ m+1 (n, r) as given below [33]: 2) Averaged Fuzzy Entropy: AFuEn is a novel and improved model of FuEn. Various approaches have been pro- posed to implement this entropy [34]. In this method, an improved m pattern Γ k [X m j ] is compared to X m i . At this entropy, equation (6) is modified as follows [34]: In the following, four different types of Γ k [X m (j)] operations with k={T,R,I,G} are defined as follows [34]: • An inversion at the position n, k = I is corresponding to In this case, four fuzzy entropies including FuEn T , FuEn R , FuEn I , and finally FuEn G are obtained. The following fuzzy entropy is computed as follows [34]: 3) Multi-Scale Fuzzy Entropy: In MFuEn, slight variations in EEG signals are detected with high precision. At this entropy, we have [35]: Where y τ (j) represents the large series of the structure, τ is the scale factor, u i indicates the independent components of the time series, and N is the total data points in the EEG signals. Finally, MFuEn for any large series of the structure y τ (j) is calculated using the equation below [35]: A and B are counters that analyze m and (m + 1) pattern matchings with the value r. 4) Refined Composite Multiscale Fuzzy Entropy: RCM-FuEn based on µ and σ are the two techniques introduced by [36]. For embedding dimension m, scale factor τ , φ m τ,k |(k = 1, ..., τ ) and φ m+1 τ,k |(k = 1, ..., τ ) for each Z (r) k |(k = 1, ..., τ ) are calculated separately. The RCMFuEnσ is computed as follows [36]: RCMFuEnσ and RCMFuEnµ have differences that both use different equations in their first step algorithm. The tolerance r, Fuzzy entropy power n, the embedding dimension m were chosen as 0.15, 2, and 2 respectively [36]. 5) Fractional Fuzzy Entropy: As shown in [37], a new fractional based Shannon entropy is introduced as follows: Also, fractional-order information of order α can be deducted using : Using the base idea of the Shannon fractional entropy, in [37] a Fuzzy based fractional entropy is introduced, which can be shown similar to equation (18).
6) Fuzzy Approximate Entropy: In FuApEn, the similarity index depends on the fuzzy membership function [38]. Hard boundaries are loosened by choosing the points approach over the Heaviside function. Similarity degree D m ij between two vectors X m i and X m j is calculated by a fuzzy membership function by using a predetermined tolerance value r as below [38]: The function C m r is given by FuApEn(m, r) can be defined as time series measure from the function φ (m+1) (r) and the vector sequence {X m+1 i } where sequence length N , tolerance r, and dimension m as given below [38]: FuApEn can be defined for finite datasets from the statistics as below [38]:

7) Minimum Variance Modified Fuzzy Entropy:
The modified FuEn is proposed (MoFuEn) by [39] to tackle membership functions limitations. The relative energy function ψ is estimated by using N as segmentation length, time-series The MoFuEn is calculated using relative energy as membership function as follows [39]: And MVMFuEn is defined as [39]: Where σ 2 Hnew is the variable of H new . More information about MVMFuEn is presented in [39].
8) Inherent Fuzzy Entropy: IFuEn is presented for the first time in [40] and includes three primary steps. In the first step, several IMFs are generated by decomposing the original signal x(t) and regeneration of signalx(t) using EMD techniques. In the second step, FuEn is applied to evaluate the complexity. Finally, the MFuEn version similar to relations (13) and (14) is used for the third stage. The details of this entropy are presented in [40]. 9) Fuzzy Distribution Entropy: This entropy has for steps reconstruction of state-space, distance matrix construction, similarity degree calculation, probability density estimation, and FuDistEn calculation. In reconstruction of state-space stage, baseline removal is done like FuEn as a first step and vectors of N − m + 1 m-dimensional are created [27]. In step two, Chebyshev distance is utilized in FuDistEn. In order to estimate similarity degree D m ij exponential function and fuzzy membership functions are used [27]. In probability density estimation step, the diagonal elements of D m ij are not included to shun self-matching and vector R m is obtained by transforming the matrix. Finally, FuDistEn calculation is as eq. (28) as follow [27]: Which P t be the probabilities of ePDF, tolerance r, the order of n, and embedding dimension m.
10) Cross Fuzzy Entropy: Two distinct signals' similarity or synchrony can be analyzed using CFuEn [40]. CFuEn utilized exponential function instead of Heaviside function as used in cross-sample entropy for examining the similarity of vectors. The CFuEn parameters m, n, r can be denoted as the negative logarithm of φ m+1 (n,r) φ m (n,r) conditional probability [41].
11) Fuzzy Permutation Entropy: FuPeEn is computed as follows [29]: where L is the length of the series X. These time series are utilized to create a matrix [29].  where pm and τ are the permuted dimension and the embedded time dimension, respectively. k = L−(pm−1)τ each row of the matrix is considered as a reconstruction component. Hence, there are k reconstruction components in the matrix described above [29]. 2) We can derive a new time series constructed from the earlier time series with the values between 1 and pm! Arranging the elements in ascending order based upon their values [29].
3) m-dimensional vector is constructed by considering the length of U as N , by arranging the elements in order to reconstruct U [29].
4) Go through the Eq. (5) to (9) as described in the standard FuEn (Eq. 9) [29]. 12) Hierarchical Measure Entropy: HFuEn is based on fuzzy entropy calculations and hierarchical procedure [42]. In this method, FuEn of each component is computed in the HFuEn analysis and then plotted as the function of the scale factor, which can be denoted as follows [42].
HFuEn(u, k, e, m, r) = F uEn(u k,e , m, r) In eq. (33), u k,e is the high frequency and low frequency component of time series u(i) at scale k and k denotes kth layer of the hierarchical analysis [42]. More details about this HFuEn provided in reference [42].
13) Fuzzy Measure Entropy: This entropy is introduced by Chen et al. [43]. At the research, FuMeEn is compared with ApEn, SampEn, and FuEn, and successful results are achieved. The FuMeEn is a generalization of FuEn and has a relation given by (34) [43]: In the equations above, FuzzyLMEn and FuzzyFMEn are the calculations of Fuzzy Entropy with upper and lower boundaries, respectively. The final relation for entropy is defined as equation (35) [43]: FuzzyMEn(m, n L , r L , n F , r F , N ) = FuzzyLMEN+FuzzyFMEN (35) The complete information on this entropy is given in [43].

D. Computational Complexity of Features
In this section, the computational complexity of these features are computed and compared. A standard method to calculate the computational complexity is using the big O notation (O) [54]. While the hidden constants and underlying framework can dramatically affect algorithms' overall runtime, the big O gives the researchers enough insights to find the most suitable feature set for their work.
As shown in [55], FuEn can be calculated in O(n 2 m) where m is the chosen length for patterns. For other advanced fuzzy entropies, usually, the base fuzzy entropy calculation is the dominant part, and their big O is similar to FuEn, i.e., O(n 2 m). However, their runtime could be different due to different hidden constants. Moreover, O for RCMFuE is of O(τ n 2 m) and for MFuEn its the scaled of O(FuEn). Also, O for FuDistEn depends dramatically on the implementation of the density estimation calculator, and that part is usually the dominant part in O calculation.

E. Dimensionality reduction using Autoencoder
One of the aspects that can affect the performance of any classification model is the curse of dimensionality [56]. Many algorithms are suggested to reduce the dimensionality of the feature vector, from both categories of supervised learning, such as Fisher [55], and unsupervised learning such as PCA [57], [58]. AEs [59], [60] are a group of unsupervised neural networks [61] that can be used for dimensionality reduction. In an AE, the input feature vector is first transformed into a smaller latent space with the encoder and then reconstructed from latent space with the decoder. Trained correctly, the encoder can be used as a dimensionality reducer.
To train this AE, an Adadelta [62] algorithm is applied as an optimizer and mean square error (MSE) as a loss function, respectively. For the last layer of AE, a tangent hyperbolic (Tanh) activation is used due to its faster convergence than the sigmoid activation function, as it has stronger gradients [63]. Also, all data are normalized to match the output of the last layer activation (Tanh). The details of the AE network  with the dimensionality reduction approach are given in Table  IV. In addition, Figure 4 shows the proposed AE architecture.
F. Classification 1) Standard ANFIS: In recent decades, many different schemas have been used to design classification algorithms; such as statistical models [64], SVMs [44], decision tree and its variations [65], ensemble learning [66], fuzzy-based models [67], and ANNs [68], [69]. The result of combining neural network and fuzzy logic is a technique called ANFIS, which was proposed in 1993 [45]. Fuzzy logic is very resembling human reasoning, and this significant issue has led to more advantages compared to neural networks. In ANFIS, analogously ANN, data inputs and labels can be applied to the network. In ANFIS, the system behavior is described by the membership function parameters from a dataset [45]. A specified error condition is utilized for the adjustment of the parameters of the system. In the following, the structure and details of the ANFIS method are discussed.

ANFIS Architecture
The learning and adaption are supported by the adaptive framework where ANFIS, Sugeno fuzzy strategy, is put into. A first-order Sugeno framework fuzzy model with the rules of IF-THEN is taken into account for the presentation of ANFIS design [45]. Rule 2: if x is A 2 and y is B 2 then f 2 = p 2 x + q 2 y + r 2 Where the inputs are x and y, the fuzzy sets are B i and A i . p i , q i and r i are the parameters of design that are denoted in training and f i are the outputs described by the fuzzy rule.
The individual layers are denoted as below with the assumption that an adaptive node is illustrated as square and a fixed node is drawn as a circle in Figure 5.
Layer 1: All the nodes i in layer 1 are adaptive with a node function [45] where x is the input to node i, µ Ai is the membership function of A i . The membership function is selected as below [45]: µ Ai (x) = 1 Or where a i , b i , c i is the principle parameter set and x is the input [45].
Layer 2: The fixed nodes are presented in layer 2 and 3. In Layer 2, they operate as a simple multiplier and marked as M. The output is as follows for Layer 2 [45]: These are the firing strength of the rules. Layer 3: The firing strength of layer 2 is normalized by the nodes and marked as N and represented as below [45]: Layer 4: The product of a first-order polynomial and normalized firing strength is the output of Layer 4, where nodes are adaptive. The outputs are illustrated as below: where ω i is the output of layer 3 and {p i , q i , r i } is the consequent parameter set [45].
Layer 5: There is a single fixed node marked as S in layer 5. All incoming signals are summed up by the node. The output as a whole is depicted as follows [45]: 2) Optimal ANFIS Classifiers: As mentioned earlier, fuzzy c-means clustering (FCM) is arguably the best method for conducting the fuzzy inference system (FIS) in ANFIS. Two schemas can be used to train ANFIS, namely, backpropagation and Hybrid methods [45]. These methods directly affect membership functions, input, and outputs of the FIS in the training phase. Here, we used various optimization algorithms to improve ANFIS performance. In the suggested ANFIS, first, the membership functions' parameters are all put together in a vector; then, using PSO or BS optimizer, the best values are picked to minimize a chosen cost function. The cost function is described as follows: Where N is the number of ANFIS inputs, e i shows the error, x i shows input values, θ are ANFIS parameters, n is the number of data instances, and y i is ANFIS output. Finally, GOA, PSO, and BS are used to minimize the error. In this section, GOA [46], PSO [47], and BS [48] optimization algorithms are applied separately for network training instead of back propagation procedure. The description of GOA and PSO algorithms can be found in their reference paper; also, the BS algorithm is explained below.
Breeding Swarm Optimization (BS) In this section, the BS algorithm, which is a hybrid genetic algorithm (GA)-PSO algorithm, is presented. Both GA and PSO algorithms have advantages and drawbacks [48].
A PSO particle memorizes a part of the search space having better performance (a memory to store past experience), in GA, if a particle is not selected in the crossover or mutation phase, the relevant information of the particle is lost. Therefore, in the BS algorithm, the strengths of both PSO and GA algorithms are combined [48]. The algorithm combined the steps of standard velocity and particle position update in PSO with the steps of selection, crossover, and genetic mutation in GA as a result, the GA section of the BS algorithm facilitates the global search, and the PSO section accomplishes the local search [48]. The steps for implementing this algorithm are as follows [48]: • Step 1: Generate a random population • Step 2: Calculate the fitness of each particle according to the cost function • Step 3: Select P best particles applying the roulette wheel algorithm  • Step 4: Perform step 3 of GA and PSO in parallel and creation a new population with PSO and GA outputs • Step 5: Go to step 2 to achieve convergence. Figure 6 exhibits the block diagram of the BS algorithm steps.

III. STATISTICAL PARAMETERS FOR CLASSIFICATION PERFORMANCE
The classification results are evaluated using 10-fold cross validation method. The advantage of K-fold cross-validation is that all the observations in the database are eventually used for both training and testing. Finally, the performance of the algorithm is estimated using evaluation metrics such as specificity (Spec), sensitivity (Sens), accuracy (Acc), and F1-Score (F-S) that is shown in Table V. These terminologies are extracted from the confusion matrix: true positive (TP), false negative (FN), true negative (TN), and false positive (FP) [55].

IV. EXPERIMENT RESULTS
In this section, the results of the proposed CADS based on fuzzy theory and deep learning techniques for the automated diagnosis of epileptic seizures are presented. The system used in this work had a Ryzen 1700 CPU, an Nvidia 1060 GPU, and for preprocessing, feature extraction, and classification. The identical preprocessing steps are adopted to preprocess the two datasets Bonn and Freiburg. First, the signals of both datasets are decomposed into the same time windows, and then TQWT is applied to decompose the signals into meaningful frequency sub-bands. At this stage, the windowing direction of the two datasets signals are selected in such a way as to achieve the highest level of efficiency and classification accuracy. In our previously conducted studies using the same database, a significant performance is achieved using EEG signals of the Bonn database with 5-seconds frame duration and outperformed other time frames [19], [55]. Hence, we have considered 5 seconds time window for this work also. Additionally, in the Freiburg dataset, each signal is decomposed into 4-second time windows based on [71], [72], [73]. As aforementioned in the previous sections, the TQWT has three important parameters Q, r, and J to decompose the signals into different sub-bands. In this study, these parameters are selected as Q = 1, r = 3 and J = 8 for both datasets. In Figure 2, a signal from the Bonn dataset using TQWT is decomposed and demonstrated. In this study, the combination of various types of fuzzy en- tropies for feature extraction from EEG signals has been done for the first time. Each of the entropies involves a different computational complexity. To demonstrate the computational complexity of fuzzy entropies, they are employed on a frame of the Bonn and Freiburg datasets, and their execution times are shown in Figure 7. According to Figure 7, the minimum execution time is relevant to FuEn, and the highest time is allocated to FuDistEn. Figure 7 shows the execution time of each fuzzy entropy while applied to raw EEG signals and subbands of TQWT, respectively. In this step, 15 fuzzy entropy were extracted from 9 subbands of TQWT. Therefore, for each frame of the EEG signals of the Bonn or Freiburg datasets, 135 features have been acquired. Next, in order to lessen the dimensions of the feature matrices of Bonn and Freiburg datasets, an AE network with the proposed number of layers has been used. Applying AE with dimensionality reduction allows the informative features to be selected and less effective features to be removed, which helps to enhance the performance of CADS. According to Figure 4 and Table IV, after feature reduction, 32 features are obtained.
In the final step of the proposed CADS, a variety of different classifier algorithms were assayed containing two groups of fuzzy and non-fuzzy. Non-fuzzy methods embrace SVM, KNN, MLP, and RF. Also, fuzzy techniques for classification are based on the ANFIS method. Takagi-Sugeno Kang (TSK) [74] fuzzy system has been used to implement various classification procedures based on ANFIS. The basic fuzzy system of all these approaches is genfis-3 which is based on FCM method [75], [76]. The genfis-3 function is based on the Gaussian membership functions, and in our research, two and three membership functions are applied for each input. Figure  8 displays a number of membership functions based on genfis-3 for some inputs of the Bonn and Freiburg datasets.
In this research, the standard ANFIS takes the advantage of various training procedures that the hybrid method has been exploited. As mentioned earlier, in ANFIS-PSO, ANFIS-GOA, and ANFIS-BS methods, an optimization method has been applied for the training. Therefore, the only difference between the standard ANFIS and its improved versions is in the training phase. Additionally, the important hyper parameters of PSO, GOA, and BS algorithms are given in Table VI. In the following, the results of fuzzy and non-fuzzy classifier algorithms for each dataset are provided. In order to assess the performance of classification algorithms, each method is executed 10 times under identical conditions, and the evaluation parameters are reported on average. Carrying out this issue so makes the reported results more reliable and eliminates under/over performances due to chance. Figure 9 and Table  VII show the average results of different classifiers for the Bonn and Freiburg datasets, respectively. Results show that, the ANFIS-BS classifier achieved higher performances.
Applying the BS optimization method alongside ANFIS classification resulted in better performance of the ANFIS-BS method compared to others. In ANFIS, the backpropagation technique is used for training, which is based on gradient descent [77]. Gradient descent moves toward the optima in the opposite direction of the loss function's gradient. Choosing the correct learning rate dramatically affects the performance of this method; a large rate may cause the algorithm to overshoot the optima, while low rates may lead to small steps, thus the algorithm not learning anything [78]. To solve this issue, researchers have used optimization techniques for the training of ANFIS and have reached promising results on many tasks [79], [80], [81]; this paper is an example of these methods' capabilities. As shown in Figure 9 and Table VII, ANFIS-BS outperformed other classification methods. This is arguably due to the combination of GA and PSO in the BS algorithm; while BS algorithm has inherited the PSO speed benefits, also by adding GA, the performance has improved noticeably.

V. LIMITATIONS OF THE STUDY
This section is devoted to discussing the limitations of the proposed method. For the first limitation, the high computational cost in the feature extraction can limit the applications of the proposed system; as a solution to this problem, the method can be implemented on hardware such as field programmable gate array, with appropriate approximations to increase the speed. The second limitation relates to setting hyper-parameters in fuzzy entropies; given that nonlinear feature extraction methods such as fuzzy entropies require precise parameter adjustments to achieve high accuracy results, they are usually chosen by trial and error, limiting their performance to the accuracy of these trials. Other limitations of the proposed method are the use of ANFIS for classification applications.
As mentioned in the previous sections, the ANFIS classification method's optimization has been done using GOA, PSO, and BS algorithms. Precisely adjusting the parameters of PSO and BS algorithms to increase the performance of ANFIS is time-consuming and requires sufficient knowledge in the field of optimization and fuzzy algorithms. In this paper, ANFIS, ANFIS-GOA, ANFIS-PSO, and ANFIS-BS classification techniques are implemented based on the TSK model. In MATLAB, the basic TSK system is implemented based on the Gaussian membership function, which is a limitation, considering that other types of membership functions such as triangular and trapezoidal can not be examined and tested in the proposed classification methods.  Diagnosis of epileptic seizures in the early stages is of particular significance to physicians and neurologists. Early detection of epileptic seizures allows specialist physicians to control the disease and prevent further progression.
So far, various methods have been proposed for epileptic seizures detection, among which the recording of EEG signals has received a great deal of attention among physicians and neurologists. EEG signals provide physicians with significant information about the function of brain activity. The most important advantages of EEG recording possess low cost and accurate display of brain neuronal function for accurate diagnosis of epileptic seizures. However, diagnosing epileptic seizures based on EEG signals is always a challenging task for physicians. The high complexity, the presence of different noises, and the long-term EEG signal recording are among the most important problems that make it difficult for specialist physicians or neurologists to precisely and quickly diagnose epileptic seizures [149].
In recent years, researchers have tried using AI techniques coupled with EEG signals to assist physicians in diagnosing epileptic seizures faster and more accurately. So far, much research has been conducted on the implementation of CAD systems based on AI for epileptic seizure diagnosis [150], [151], [152], [153], [149]. AI-based CAD systems for diagnosing epileptic seizures include both conventional machine learning and deep learning [150], [154].
In this paper, a novel CADS is introduced for epileptic seizures detection from EEG signals using fuzzy theory and deep learning methods. The proposed method involves four steps of preprocessing, feature extraction, dimensionality reduction, and classification. Preprocessing consists of two parts: windowing the EEG signals and then decomposing them into different sub-bands using TQWT. First, the EEG signals of the Bonn and Freiburg datasets are decomposed into various time windows. The objective is to achieve maximum CADS performance for two different datasets. The EEG signals of the Bonn dataset are segmented into 5-seconds time windows similar 99  to [19], [55]. Additionally, the EEG signals of the Freiburg dataset have been decomposed into 4-second time windows based on [71], [72], [73]. In the second stage of preprocessing, TQWT is exploited to decompose the EEG signals of both datasets into 9 sub-bands. EEG signals possess fundamental information in different frequency bands. Consequently, the decomposition of EEG signals into various sub-bands using TQWT enhances the efficiency of CADS in epileptic seizures detection. TQWT has three main parameters, r, J, and Q; selected values for both datasets are r = 3, Q = 1, and J = 8.
In the next step, type-1 fuzzy entropies are applied for feature extraction from different sub-bands of TQWT. In all previous works [11], [155], [156], [157], this combination of fuzzy entropy types is not used for feature extraction, and this step is one of the novelties of our paper. Also, in this stage, the computational complexity for each fuzzy entropy is calculated as another novelty of this work. Calculating the computational time complexity of feature extraction algorithms is very important for signal processing researchers. So far, in several studies, computational complexity in feature extraction algorithms has been considered by researchers [158], [159], [160], [161], [162]. In this research, for the first time, the computational time complexity for fuzzy entropies is presented. In addition, Figure 7 displays the run times for each fuzzy entropy, which is highly important for practical applications and hardware implementations. The proposed AE architecture with 6-layers is presented in the dimensionality reduction section, which is another novelty of this work.
Finally, various fuzzy and non-fuzzy techniques have been applied in the classification step. In this section, the ANFIS-GOA and ANFIS-BS methods have been employed for the first time in epileptic seizures detection and are another novelty. The ANFIS-BS method outperforms ANFIS-PSO and ANFIS-GOA. This verifies that the choice of an optimization method along with ANFIS demands high knowledge in the fuzzy systems theory and optimization methods.
The proposed method results show that the ANFIS-BS classifier method has been able to reach the highest accuracy among all fuzzy and non-fuzzy classifiers for its two different datasets. The reason behind the high efficiency of the ANFIS-BS procedure against all fuzzy and non-fuzzy classifier algorithms is that the BS optimization algorithm is a combination of GA and PSO methods. In the Bonn dataset, the best performance is acquired using ANFIS-BS, which in the two-class and three-class mode are 99.74% and 99.46%, respectively. Also, the ANFIS-BS method on the Freiburg dataset provides 99.28% accuracy, which is the highest efficiency compared to other classifier methods. In addition, it should be reminded that in this study, we have used the K-fold method with k equal to 10 for evaluation in all classifier methods.
According to Tables VIII and IX, our proposed method has achieved higher accuracy than most studies. The results indicate that the proposed technique compared to other studies, has attained an acceptable accuracy in diagnosing epileptic seizures. The proposed approach takes advantage of a combination of fuzzy logic and deep learning and has been successful in diagnosing epileptic seizures. The proposed method can aid physicians and other relevant medical professionals in the future as a software or hardware platform in diagnosing and predicting epileptic seizures using EEG signals. It can be help physicians in the rapid and accurate diagnosis of epileptic seizures in the near future, which will reduce the time to diagnose epileptic seizures.