Revised Tunable Q-Factor Wavelet Transform for EEG-Based Epileptic Seizure Detection

Electroencephalogram (EEG) signals are an essential tool for the detection of epilepsy. Because of the complex time series and frequency features of EEG signals, traditional feature extraction methods have difficulty meeting the requirements of recognition performance. The tunable Q-factor wavelet transform (TQWT), which is a constant-Q transform that is easily invertible and modestly oversampled, has been successfully used for feature extraction of EEG signals. Because the constant-Q is set in advance and cannot be optimized, further applications of the TQWT are restricted. To solve this problem, the revised tunable Q-factor wavelet transform (RTQWT) is proposed in this paper. RTQWT is based on the weighted normalized entropy and overcomes the problems of a nontunable Q-factor and the lack of an optimized tunable criterion. In contrast to the continuous wavelet transform and the raw tunable Q-factor wavelet transform, the wavelet transform corresponding to the revised Q-factor, i.e., RTQWT, is sufficiently better adapted to the nonstationary nature of EEG signals. Therefore, the precise and specific characteristic subspaces obtained can improve the classification accuracy of EEG signals. The classification of the extracted features was performed using the decision tree, linear discriminant, naive Bayes, SVM and KNN classifiers. The performance of the new approach was tested by evaluating the accuracies of five time-frequency distributions: FT, EMD, DWT, CWT and TQWT. The experiments showed that the RTQWT proposed in this paper can be used to extract detailed features more effectively and improve the classification accuracy of EEG signals.

50 million people [1]. EEG is a valid and noninvasive method for recording brain activities and can be used in epilepsy diagnosis. However, the manual detection of seizures is time-consuming due to the nonstationary and stochastic nature of EEG signals. In previous feature extraction methods for detecting epilepsy, these requirements were ignored or time-frequency information was not adequately considered. To reduce the risk of seizures and seizure-related complications, a rapid and accurate diagnosis of epilepsy is essential for patients [2], [3], [4], [5]. These restrictions have driven the design and development of diagnostic systems to classify epileptic and nonepileptic signals.
Extensive research has been carried out to identify epilepsy from EEG signals, resulting in a number of epilepsy feature extraction methods. The most commonly adopted feature that is widely implemented in EEG signal characterization includes Fourier transform (FT), empirical mode decomposition (EMD), and wavelet transform (WT) [6], [7], [8], [9], [10]. A Fourier transform decomposes the nonstationary signals into different frequency parts. The EEG signals are transferred from the time domain to the frequency domain to extract the most discriminative features. These features were used to classify seizure and nonseizure electroencephalograms [13], [14]. However, EMD is a time-frequency decomposition technique from a time domain perspective. The intrinsic oscillatory modes in EMD depend on the characteristics of the time scale, which is widely applied in nonstationary signal recognition [15], [16], [17], [18]. To obtain sufficient information from different bands of wavelets, another method of EEG data analysis is the wavelet transform. The wavelet transform is an improved method of implementing the FT that can provide good localization in the time and frequency domains. WT realizes conversion with a set of wavelet basis functions, which have been widely utilized in automatic seizure detection [19]. Wavelet transform applications are used in three key areas of EEG: preprocessing signals, feature extraction, and focus localization. Preprocessing signals in the wavelet transform include denoising signals, removing artifacts, etc [20], [21]. The extraction of features by wavelet transform is based on wavelet decomposition and subband coefficients. Many different features extracted from subband coefficients were utilized in many classifiers [22], [23], [24], [25], [26], [27]. Focus localization is another application of wavelet transform in EEG classification. The wavelet parameters, including the basis function, Q-factor, and decomposition levels, are essential elements of excellent focus localization. There have been many studies relating to EEG focus localization [28], [29], [30]. However, traditional constant Q-factor wavelets such as the continuous wavelet transform, which cannot be adjusted instantaneously to the Q-factor, limit its application to non-linear non-stationary signals. For example, in engineering applications to extract the complex and variable oscillatory components of machine fault signals or EEG signals, the constant Q wavelet transform is only able to dimension a single Q-factor and cannot be flexibly adjusted. This property of the wavelet creates an obstacle to the accurate extraction of the transient state components during detection.
Recently, the tunable Q-factor wavelet transform (TQWT) [31] has been widely used for detection and feature extraction of epilepsy EEG [32], [33] as well as filtering and denoising EEG signals [34]. TQWT differs from most wavelet transforms incapable of adjusting their Q-factors in that its Q-factor can be tuned. The oscillatory characteristics of the wavelet vary as its Q-factor varies. TQWT has emerged as a powerful tool for the oscillations of EEG signals to be applied [35]. By selecting the appropriate Q value, nonlinear optimization and intelligence optimization methods can be employed. An adaptive TQWT based on particle warm optimization (PSO) [36] and wavelet entropy [37] was proposed to extract potential signal features. The TQWT depends on the oversampling rate of a signal instead of the frequency. Thus, the successful oscillation feature corresponding to the specific frequency in EEG relies heavily on the Q-factor related to wavelet characteristics. That is, sufficient oscillatory information extraction is achieved using the TQWT with the best-fitting Q-factor.
In short, the Q-factor of the wavelet cannot be flexibly adjusted in the constant wavelet transform. In the case of the TQWT, evaluation criteria for the Q-factor are lacking. To address this issue, we propose a revised tunable Q-factor wavelet transform (RTQWT) based on the weighted normalized entropy to detect the EEG signals for epilepsy detection. The method consists of an adaptive measurement to select TQWT parameters with distinctive subbands. The weighted normalized entropy of wavelet subbands is a criterion for the selection of the TQWT parameters. The entropy minimization corresponds to the best-fit parameters for TQWT oscillations. The energy ratio distribution is then developed to select the best subbands for the construction of new features that are utilized as the input to the different classifiers. Finally, the RTQWT-based EEG features are trained by five classifiers (decision tree, linear discriminant, naive Bayes, SVM and KNN). The classification accuracy of each classifier is used as a performance evaluation for identifying epilepsy. The contributions of this paper can be briefly summarized as follows: (1) A criterion of TQWT parameters based on a weighted normalized entropy is proposed. This entropy measures the degree of completion of EEG signal decomposition and provides guidance for the selection of TQWT parameters suitable for EEG oscillations.
(2) The EEG is decomposed using the revised TQWT parameters, and specific and common characteristic subspaces are distinguished from the decomposed subbands. The most representative features of the epileptic EEG signals are constructed by selecting the appropriate subbands from the energy distribution criteria of the feature subspace. This subband selection criterion eliminates redundant and nonvaluable timefrequency information.
(3) The feature signals constructed by combining specific feature subspaces and common feature subspaces are applied to different classifiers to detect epilepsy. The results show that RTQWT can be used to extract sufficient information from the specific feature space to complete the detection of epilepsy. The effectiveness and robustness of RTQWT is also verified by the recognition performance of different classifiers.

II. PROPERTIES OF WAVELET TRANSFORM
In this section, we review the process of wavelet decomposition and properties of wavelet transform. A novel idea of tunable Q factor is proposed in a recent study by Selesnick [31] which we combined this tunable Q-factor wavelet with multiresolution analysis theory in the field of EEG signals. We generally distinguish a few of the most commonly used feature extraction methods. These methods process signals in the time-frequency domain. Time-frequency features are typically calculated to contain the frequency information, but also the features of signal in time domain have been preserved.

A. Wavelet Transform
To trade off the characteristics of nonstationary signals in time and frequency domain, wavelet transform has been widely applied in EEG signal analysis. The wavelets transform herein contain discrete wavelet transform (DWT) and continuous wavelet transform (CWT).
The DWT can be described as a decomposition procedure of input signals into sets of wavelet subbands by scaling and shifting the parameters of mother wavelet function. An example is the Haar wavelet transform. Yet, the main weakness of the DWT is that it does not solve the problem of how to approximate continuous functions because of the discontinuity of the DWT [38]. The CWT is composed of a family of parametric wavelet atoms ψ m,n (t), which possesses similar continuous and localization properties as the DWT [39]. The mother wavelet of CWT can be described as, where m and n are the scaling and translating parameters. The mother wavelets ψ m,n (t) are required with zero mean to the well-localization in time. The decomposition procedure of input signals X (t) is implemented by the convolution between X (t) and ψ m,n (t). The wavelet coefficients of CWT are expressed as, where * denotes complex conjugate. The wavelet function ψ m,n (t) is obtained from the scaling function φ(t). The relation between wavelet function and scaling function can be described as, The scaling functions {φ(2 j t − i), i, j ∈ R} forms the subspaces {V j , j ∈ Z }. This space {V j , j ∈ Z } is compactly supported constant function space. And the family of wavelet function ψ m,n (t) forms the wavelet subspace {W j m,n , m, n, j ∈ Z }. The W j is the orthogonal complement of V j in V j+1 . So, the subspaces {V j , j ∈ Z } and {W m,n , m, n ∈ Z } can be constituted to the complete signal space. In general, the procedure of signal decomposition with wavelet provides analysis in the multiresolution subspaces. The signals are mapped into different resolution subspaces so that specific features can be extracted. According to the [40], the multiresolution analysis (MRA) is defined as, Definition 1: MRA: If the subspaces {V j , j ∈ Z } satisfies, called as the approximation subspace. Besides, the W j is the orthogonal complement of V j in V j+1 . So, the signals space L 2 (r ) can be expressed as, where the ⊕ represents the orthogonal relationship. Based on the (4), any signal function f (x) in L 2 (R) can be expressed to the −∞ +∞ w k . In other words, the family of wavelet function {ψ j,k , j, k ∈ Z } is the standard orthonormal basis of the signal space L 2 (R). The {ψ j,k , j, k ∈ Z } is called the wavelet subspace. Following the definition of MRA, we verify that the wavelet functions in the DWT and CWT satisfy this standard. The family of wavelet functions in DWT and CWT are constructed to themselves multiresolution wavelet subspaces. Signals with the decomposition by the multiresolution wavelet subspaces are mapped to multi-scaling frequency subspaces. We analyze the time-frequency feature in depth through the decomposition results. The oscillations of the signals are interpreted from multiple perspectives.
A very important property in the wavelet transform that measures wavelet fluctuations is the Q-factor of the wavelet. Specifically, the Q-factor of wavelet is defined by the ratio of the center frequency to the bandwidth.
where ω c and B are center frequency and bandwidth of the wavelet function. TThey are eligible for MRA for the wavelet functions in DWT and CWT. However, a drawback of these wavelet functions is the fact that the Q factor of these wavelets is fixed once these wavelets are determined. The oscillations of the wavelets are also determined, which reduces the sensitivity to different fluctuations in the signal. Due to the constant Q-factor in DWT and CWT, the oscillations of signals are extracted inadequately. To solve this obstacle, the tunable Q-factor wavelet transform (TQWT) is proposed. TQWT is also a wavelet transformation that satisfies the restrictions of MRA. The elements and associated properties of the TQWT are described below.

B. Tunable Q-Factor Wavelet Transform
The TQWT is composed of a Fourier transform and a two-channel filter bank, which can be implemented by radix-2 FFT algorithm. In practical implementation of the algorithm, TQWT is easier and faster than CWT. The subbands of TQWT decomposition are another way of composing signal space that line with the standard defined in (4). The signals mapped to multiresolution wavelet subspaces are easier to discover the details in multiscaling. Each subspace of multiresolution spaces represents specific characteristic information. The following investigates the TQWT decomposition and the influence of TQWT parameters on wavelet properties.
The parameters of Q-factor, redundancy and decomposition level can be tuned, which is the unique characteristic of TQWT [31]. The TQWT decomposition of level J is illustrated in Fig. 1, where the parameters of α and β are the low-pass and high-pass filter scaling parameters, respectively. These contain the high-pass production of each level {h 1 , h 2 , . . . , h J } and the J low-pass output l J (n). The relationship between (Q, r, J max ) and (α, β) is described as where ω c and B represent the center frequency and bandwidth of subband respectively. The N is the length of the signal. 1) TQWT Filter Banks: In each decomposition level, the low-pass filter H 0 (ω) with α and the high-pass filter H 1 (ω) with β are constituted to the filter banks [31]. The filter banks are designed to meet the criteria where the θ (·) represents the Daubechies frequency response function with 2π period. Specifically, the function is given by θ (ω) = 0.5(1 + cos ω) √ 2 − cos ω, | ω |≤ π . Due to this function satisfying θ 2 (ω) + θ 2 (π − ω) = 1 in the transition bands, the perfect reconstruction condition is fulfilled.
The low-pass filter banks represent the subspace of V j and high-pass banks represent the subspace of W j . And the filter scaling is constrained by the requirement of 0<α ≤ 1 and 0<β ≤ 1 to guarantee that TQWT is not redundant. Meanwhile, zero-padding is required in the actual signal decomposition [31]. So, the filter banks must be oversampled. The filter scaling must be strictly satisfied with the condition of α +β>1 so that TQWT is perfectly reconstructed and fulfils the definition of MRA. Fig. 2 presents all the TQWT filter banks and their subbans, where the parameters of TQWT are set as Q = 2, r = 3, J = 10. Fig. 2(a) represents all filter response frequencies and their magnitudes. Fig. 2(b) shows all subbands in 100 samples. It is worth mentioning that the oscillation of different subbands is unsimilar. The distinction indicates that the energy contained in subbands is unique, which is a highly marked characteristic compared to the constant wavelet transform. 2) Center Frequency and Bandwidth of TQWT: From (6) and (7), the scaling parameters (α, β) are transformed by (Q, r ) as These subbands corresponding to the center frequency and bandwidth present the wavelet identical oscillatory characteristics [37]. For the level j high-pass filter bank, the frequency response interval is The interval is represented by Q-factor and redundancy, Based on this interval if the input sampling rate is f s , the level j center frequency ω j c and bandwidth B j can be obtained by, The level j center frequency ω j c and bandwidth B j are related to the low-pass scaling α and high-pass scaling β. The variety of center frequency and bandwidth, related to wavelet subband, would lead to altering the oscillations of wavelet.

III. REVISED TUNABLE Q-FACTOR WAVELET TRANSFORM
As the Q-factor and redundancy have a significant effect on wavelet waveform, the following introduces a selection criterion of parameters to revise TQWT. This method is called revised tunable Q-factor wavelet transform (RTQWT). RTQWT determines the optimal Q-factor and redundancy for signal decomposition and distinguishes between specific and common characteristic subspaces to improve the performance in signals identification. The procedure comprises three significant steps and is elaborated in the following subsections, (1) The optimal parameters of Q-factor and redundancy are revised with weighted normalized entropy to achieve the better signal decomposition. The subbands decomposed by RTQWT contain more detailed information about signals.
(2) Features are constructed with the distinctive subbands corresponding to the specific characteristic subspace decomposed by the optimal parameters of revised TQWT. These features include the oscillations specific information without other confusion patterns.
(3) The constructed signals containing specific and common characteristic subspaces are identified by various classification methods. The effectiveness and robustness of RTQWT feature extraction are verified in different machine learning methods.

A. Analysis for Parameters of TQWT
Based on (13) and (14), the center frequency and bandwidth are associated with the Q-factor, redundancy and decomposition level. Fig. 3 depicts the TQWT frequency responses and waveform in various TQWT parameters. Fig. 3 illustrates the frequency response and waveform of TQWT for various choices of the parameters Q, r , and J . As the Q-factor can be tuned in continuously, the waveform and response change simultaneously. The following discussion clarifies the effect of Q-factor, redundancy and decomposition level on the characteristics of the wavelet.
1) Q-Factor: According to (13) and (14), the center frequency equals bandwidth when Q-factor equals one, which means that the wavelet is no oscillation [37]. In fact, Q-factor must be satisfied with the restriction of Q ≥ 1 and adapted the input signal. The high Q-factor of TQWT is more appropriate for the oscillatory movement. To further investigate the relation of Q-factor and wavelet oscillation, the partial derivatives of ω j c and B j with Q-factor are formulated as respectively, ∂ω where the equation (15) is an increasing function. However, the bandwidth of (16) has a zero point Q 0 , which Q 0 is 2 j r −1. So, the equation (16) is increasing function with Q-factor in lower than Q 0 and decreasing function in higher than Q 0 , which is illustrated in Fig. 4.  The specific values of center frequency and redundancy are shown in Table I. With increasing the Q-factor and values at Table I, the center frequency of all subbands keeps rising in Fig. 4(a), but the bandwidth has a turning point in Fig. 4(b) which is a maximum point varying with subband. The different oscillations of wavelets at level 5 with varying Q-factor in depth are shown in Fig. 3. The wavelet waveform, in contrast to Figs. 3(b) and 3(f), has more oscillations with Q-factor increasing. The response frequency moves to the high frequency at the same time in Figs. 3(a) and 3(e).
2) Redundancy: The redundancy r in (7) is the oversampling rate of the TQWT wavelets estimating the sum of oversampling rates of all subbands [39]. However, the set redundancy r does not equal oversampling rate of the actual decomposition because the radix-2 FFT algorithm is applied to TQWT implementation. Particularly, the parameter r is set to three or more to be sufficient for TQWT decomposition in practice [37]. The following investigates the relationship between redundancy and wavelet characteristics of the center frequency and bandwidth. To further analyze the effect of wavelet waveform and frequency difference by varying the redundancy, the partial derivatives of ω j c and bandwidth B j with redundance are formulated as respectively, Obviously, the equations (17) and (18) are the increasing function. The trend of redundancy is consistent with the variation of center frequency and bandwidth. The increase of redundancy causes the center frequency and bandwidth in the wavelet subband to grow as well, affecting the fluctuation characteristics of the wavelet.
For further analysis the wavelet waveform, contrasting Fig. 3, the oscillatory wavelet characteristics are nothing changed, but the width of the wavelets becomes narrower with redundancy rising in Figs. 3(d) and 3(f). The primary influence of varying redundancy is the adjustment of wavelet oscillations extent and the spectral overlap between the adjacent filter banks.
3) Decomposition Level: The additional parameter of TQWT is the decomposition level J , which is defined as the number of iterations of two-channel filter banks in TQWT. The more the decomposition level is, the more complicated the subband interprets. The maximum decomposition level is defined as (8). Relating to Fig. 3 with different decomposition level, the TQWT wavelet is just the increasing of subband. The shape of wavelet is maintained in Figs. 3(f) and 3(h). Increasing decomposition levels predominantly affect the number of subbands and the details of decomposition signals in Figs. 3(e) and 3(g). There is no influence on the wavelet oscillatory characteristics with increasing decomposition level.

B. Revised Tunable Q-Factor Wavelet Transform
According to the analysis of the TQWT parameters, the Q-factor and redundancy have a strong influence on the oscillatory behavior of the wavelets. Therefore, appropriate TQWT parameters are crucial for the decomposition of EEG signals. In particular, EEG signals containing many disorder fluctuations of epilepsy seizures are not sufficiently detected in the wavelet transform with a constant Q-factor. In contrast, the waveform and frequency response of the TQWT wavelets can be adjusted to match transient oscillations by tuning the Q-factor and redundancy. However, there is a lack of criteria for selecting the optimal Q-factor and redundancy. To address this problem, we propose the revised tunable Q-factor wavelet transform based on a new criterion of parameter selection.

1) The Optimized Criterion of Q-Factor and Redundancy:
Wavelet entropy is the criterion of selecting wavelet parameters, which has been successfully applied for the selection of the optimal Morlet wavelet parameters [41], [42]. The sparsity of wavelet coefficients can be estimated with wavelet entropy. The sparsest wavelet coefficients of the signal correspond to the optimal center frequency and bandwidth parameters of Morlet wavelet, which is the effectiveness of wavelet entropy [37]. The wavelet entropy of subband coefficients b k (n) defined as, where k represents the k-th subband and N k is the length of k-th subband coefficients b k (n), n represents the n-th sampling point, p k i is the probability of the b k (i) in b k (n). The k-th subband wavelet entropy E k is a suitability measurement of wavelets and signals.
However, there are two problems with wavelet entropy. First, unlike the constant Q-factor wavelet, subbands of different lengths that undergo TQWT decomposition have their own importance to each other. The k-th subband wavelet entropy E k only considers the significance of the sparsity of its own subband coefficients and ignores the effects on other subbands [37]. Second, different scales of subbands are obtained from the TQWT decomposition, while the wavelet entropy E k ignores the influence of different subband scales, which may lead to an incorrect assessment of the wavelet coefficients. More importantly, the normalized entropy of [37] has been used to mitigate the effects of different scales. Nevertheless, the weights assigned to the entropy values consider only the energy of the subbands. The neglect of the effect of wavelet subband scales leads to a bias in the results. Thus, the weighted normalized entropy is developed to revise the wavelet entropy, which determines the optimal Q-factor and redundancy and the corresponding wavelet basis function for decomposing the epileptic EEG signal.
Assuming that the coefficients of wavelet subbands using TQWT parameters Q, r are obtained by {C 1 , C 2 , . . . , C J max }, where the composition level is set to the maximal level J max . To address the ignorance of the subband length in weight of energy, wavelet entropy is weighted by ω k (Q, r ), and the probability of subband coefficients p k i (Q, r ) is redefined as, where ω k (Q, r ) is the weight of the k-th wavelet coefficients C k . N k is the length of the k-th subband. The p k i (Q, r ) estimates the probability of the i-th element of the k-th wavelet coefficients C k i (Q, r ). Therefore, the weighted normalized entropy (WNE) is defined as, E k (Q, r ) denotes the weighted wavelet entropy of the k-th subband when the TQWT parameters is Q, r in (23). (24) is the maximal weighted wavelet entropy of all subbands. The maximum normalized entropy enhances the contrast at different subbands. Thus, WNE provides a measure of the integrity of the signal decomposition and guides the selection of the optimal Q-factor and redundancy.
Assuming the Q-factor and redundancy range of [Q 0 , Q 1 ], [r 0 , r 1 ] respectively, it calculates the weighted normalized entropy to select the optimal Q-factor and redundancy in the range. The minimum weighted normalized entropy corresponds to the optimal TQWT parameters { Q, r }, where min{·} represents the minimum function. Due to the weighted normalized normalized entropy corresponding to the completeness of wavelet decomposition, the minimum means that TQWT extracts the matched fluctuations at different frequencies from the signal. So, the result matching the wavelet characteristics relates to the minimal loss of TQWT decomposition and the maximal oscillations of the signal.
2) The Selection of Optimal Sub-Bands Based on the Distribution of Energy Ratio: The optimal TQWT parameters { Q, r } are determined by weighted normalized entropy to obtain the basis functions of the TQWT. This set of basis functions is applied to decompose the epileptic EEG signal, which results in a number of different frequency subbands. The energy of the wavelet subbands is a key feature when measuring the number of components at each frequency. Thus, for epileptic signals containing different fluctuations at specific frequency, the energy of wavelet subbands consisting of the decomposed wavelet coefficients reveals the response frequency ratio of the signals. The distribution of energy ratio implies the distribution of response frequencies and guides the selection of the appropriate subbands. Assuming the subbands are { C 1 , C 2 , . . . , C J max }, the k subband energy is defined as two-norm of the wavelet coefficients ∥ C k ∥ 2 . The k energy ratio of subbands is defined as, where C k i is the i-th element of the k-th wavelet coefficients, N k is the length of the k-th subband, the decomposition level of TQWT corresponds to the optimal parameters { Q, r } by (25). The energy ratio calculates the significance of the subband in the specified frequency domain. Based on the subband energy ratio, the distribution of energy ratio is described as, where F(E R) is the distribution of subband energy ratio. Following this, according to the distribution, the threshold value required for selecting subbands is determined. To ensure that the dimensionality of the constituent feature signals was consistent, We use the energy of a certain percentage of the subbands in the energy ratio of the subbands in the respective category as the threshold value. The values associated with this subband energy ratio are specified as, where Max p represents the top p major elements of the set. This p is 7% in our algorithm.The threshold value of (28) determines the minimum energy ratio of the subbands to pick in the experiments. It neither selects the most characteristic subbands while neglecting other frequency, nor causes the selection to useless frequency subbands. Then, the subbands are selected by the following criterion, Applied to the criterion of (29), the optimal subbands are selected based on the WNE. These subbands represent specific information containing raw signals. Following this, subbands energy is calculated as the elements of feature vectors. The construction of feature vector is defined as, where | C| is the cardinal number of the set { C}. The features F extracted by WNE represents the core of specific and common characteristic subspaces. Following the subband selection based on the distribution of energy ratio, the selected subbands are retained and the other subbands are removed by setting the wavelet coefficients to zero. The additional frequency information in EEG signals is deleted, and the frequency subbands most conducive to distinguishing are retained. Finally, the features extracted by the RTQWT are constructed to classify signals by various machine learning methods. The algorithm is described as, Algorithm 1 Feature extraction based on revised tunable Q-factor wavelet transform for epilepsy EEG classification Input: The epilepsy EEG signals X = {X 1 , X 2 , · · · , X n }, the corresponding label Y = {y 1 , y 2 , · · · , y n } Output: The identified labels Y ′ = {y ′ 1 , y ′ 2 , · · · , y ′ n }. 1: Determining the range of Q-factor and redundancy to EEG signals X i .

IV. EXPERIMENTAL VERFICATION
The performance of the proposed RTQWT feature extractor is analyzed in terms of different databases. Moreover, five other feature extractors were deployed in this work: Fourier transform (FT), empirical mode decomposition (EMD), discrete wavelet transform (DWT), continuous wavelet transform (CWT) and tunable Q-factor wavelet transform (TQWT). According to the subband selection based on the distribution of the energy ratio, the extracted feature vector consists of 6 elements. The frequency bands corresponding to the selected wavelet subbands in the wavelet transform are calculated as the features of FT and EMD in terms of the average frequency band energy.
We obtain the performance of RTQWT to evaluate the effectiveness of this algorithm in real epilepsy EEG signals. The epilepsy EEG signals are from the Bonn database. The database are publicly available and are widely used by researchers [28], [30], [32], [33], [36]. The real epilepsy  [43] is used to verify the effectiveness and robustness of our algorithm. The Bonn database consists of five subsets, as shown in Table II. Subsets A and B are the data collected from the five healthy subjects. Subsets A and B represent the EEG signals of healthy individuals with eyes opened and closed, respectively, and the distribution of the acquisition electrodes is an international 10-20 system. Subsets C, D, and E are EEG signals acquired from five patients with preoperatively diagnosed epilepsy. Subset C comprises EEG signals collected during the interictal period on the contralateral side of the epileptic focus, and subset D contains interictal EEG signals collected at the epileptic focus. In subsets C and D, deep electrodes and lateral and low area strip electrodes located in the neocortical layer were used, and their data were acquired from intracranial electrodes during the seizure phase signal.
Each subset comprises data from 100 trials, each of which is a 128 channel EEG signal with a sampling frequency of 173.61 Hz and an acquisition duration of 23.6 seconds. These EEG signals are all cut from the acquired long-range multichannel EEG with the muscle movement artifacts and eye movement artifacts removed. A tenfold cross-validation of the data is performed in the experiment, and the experiment is repeated 50 times. Finally, the mean of all the results is taken as the final recognition accuracy of the epilepsy EEG signals, and the standard deviation of the accuracy is given.

A. The Analysis of Epilepsy by TQWT and RTQWT
The Bonn database as in Table II contains five states of EEG signals. Here, we consider subsets A and B as the normal EEG signals, subsets C and D as the interictal signals, and subset E as the seizure EEG signals. A random sample of the data set for each state is shown below. Fig. 5 shows the data for the three different states over time. The complexity and nonlinearity of the epileptic states makes it impossible to directly discern the particular fluctuating nature of epilepsy. In order to analyse and fully extract this fluctuating characteristic, we decomposed the samples in dataset E using the TQWT and RTQWT methods, respectively. The TQWT method was used directly for the analysis, and due to the lack of criteria for parameter selection only the TQWT was selected empirically according to [32], TQWT parameters setting to Q = 1, r = 3. For the RTQWT method proposed in this paper, the quality of the RTQWT signal decomposition was evaluated using the WNE criteria, and the parameters of the RTQWT for the Bonn database were finally determined to be Q = 2.5, r = 3, respectively.
The frequency response of each subband of these two wavelets can be plotted according to the parameters Q = 1 and r = 3 for the TQWT and Q = 2.5 and r = 3 for  the RTQWT. The frequency responses of these two wavelets are shown in Figs. 6(a) and 6(c), respectively. The functions of these two wavelets can be plotted using the Fourier inverse transform, corresponding to Figs. 6(b) and 6(d), respectively. In the comparison of Figs. 6(a) and 6(c), it can be seen that the wavelet frequency response under the TQWT for this parameter is more concentrated in the range 0 to π 4 , but the wavelets better corresponding to different high-frequency parts are not refined. However, the RTQWT not only refines the frequencies of each subband in the low frequency part [0, π 4 ] but also allows for a better frequency response in the high frequency part. In addition, direct observations of the waveform characteristics of the two wavelets are shown in Figs. 6(b) and 6(d), respectively. The wavelets under the RTQWT have more complex and diverse fluctuation characteristics than those under the TQWT, and it is easier to identify different fluctuation characteristics of the signal.
To further enhance the feature representation capability of the RTQWT, the individual subspaces of the wavelet decomposition were selected. The most representative common and unique subspaces for different epileptic states were selected. The feature subspaces under TQWT correspond to the wavelet subband space {W i , i = 4, 5, 6}. The wavelet feature subspace chosen for the decomposed wavelet subbands of this paper under the constraint of (29) is {W i , i = 7, 8, 9, 11, 12, 13}. To further analyse the completeness of the signal decomposition by TQWT and RTQWT, the signal was reconstructed using the selected wavelet feature subspace, and the comparison between the reconstructed signal and the original signal is shown in Fig. 7. There are also no opposite fluctuation periods between the RTQWT reconstructed signal and the original signal, and the fluctuation information of the epileptic EEG signal is extracted sufficiently. It provides a more accurate feature subspace for subsequent epilepsy recognition and improves the robustness and accuracy of the epilepsy recognition process. Fig. 7(e) shows the original signal, TQWT reconstructed signal and RTQWT reconstructed signal on the same plot. It is more obvious from the figure that the RTQWT reconstructed signal fits the original signal more closely than the TQWT reconstructed signal. The original signal fluctuates more in the sampling intervals of [40,60] and [120, 140], and the fluctuations of the TQWT reconstruction signal differ more from the original signal. The waveforms of the RTQWT reconstruction signal in these fluctuation intervals are consistent with the original signal, and the fluctuation characteristics of the original signal are extracted completely.

B. Bonn Experiment
Bonn signals are decomposed by RTQWT to determine the best subbands corresponding to the specific wavelet subspaces.  The weighted normalized entropy is applied to select the optimal TQWT parameters. Due to epilepsy with lots of fluctuations, the ranges of Q-factor are [1,40] at first, and the subsequent search range is narrowed to [1,10]. Meantime, the redundancy is fixed in [3,10]. Decompose the signal using TQWT under different combinations of Q-factor and redundancy, and then calculate its corresponding weighted normalized entropy. The results for the entropy in Q ∈ [1, 10], r ∈ [3, 10] are illustrated in Fig. 8.

1) Revised Tunable Q-Factor Wavelet Transform to Bonn
Datasets: The optimal range of the Q-factor is about [1,10] in Fig. 8. In this investigation, the step of different Q-factor sets to 0.25, and the content of Q-factor sets to [1,10]. The weighted normalized entropy is calculated in varying Q-factor and redundancy. According to the change of this indicator, we can determine that the optimal parameters for decomposing the signal are Q = 2.5 and r = 3. In detail, the value of entropy is shown at Table III.
From Table III, the optimal parameters Q-factor and redundancy of TQWT based on the trend of the table may be between Q = 1.0, r = 3 and Q = 4, r = 3. The actual optimal parameters are indeed among them. Through further refine the Q-factor based on WNE in (24), we determined the optimal parameters of TQWT are Q = 2.5, r = 3 for Bonn database.
Applying the RTQWT with the parameters of Q = 2.5, r = 3, the Bonn epilepsy signals are decomposed to subbands. For finding the remarkable specific and common characteristic subspaces, we calculate the energy ratio to each subband. And the distribution of these ratios in the Bonn database is represented in Fig. 9. This distribution shows the characteristic distribution of the normal signal, the interictal signal, and the ictal signal over the frequency range of each subband. Further, we can select the most representative subbands as the specific characteristic subspace of this type of signal through this distribution. Each signal possesses its own peak of subband energy ratio in Fig. 9. The normal EEG subbands energy ratio in Fig. 9 is relatively even, and the peak of distribution appears near at 9, 10 subbands, which implies the information of EEG is in 9, 10 subband, and the corresponding response frequency is 10.9 ∼ 13.3H z. For the interictal EEG energy ratio distribution in Fig. 9, the peak of energy ratio is in 20, 21 subbands. Specifically, the subband 20, 21 holds the most fluctuating information, and the relative response frequency is 1.3 ∼ 1.5H z. Consequently, the fluctuation of interictal EEG is predominantly localized at 1.3 ∼ 1.5H z, and the oscillation features of interictal are distributed around there. The ictal EEG energy ratio distribution in Fig. 9 is not the same as the two signals. Because its distribution has two peaks, subbands 8 and 13, respectively. These multi-peaks correspond to the complicated oscillations in the Bonn epilepsy EEG. These subbands corresponding response frequencies are 16.2H z and 6.1H z. So, it means that the epilepsy characteristics are mainly in the 16.2H z and 6.1H z at most.
The remarkable subbands of three states of epilepsy EEG are drawn on Fig. 9. Thus, according to the standard defined in (27) and (29), we obtain the selected subbands 7,8,9,11,12,13. These subbands based on the peak of energy ratio distribution determine the specific characteristic subspace to each state signal. Moreover, in one state signals, the other subbands except for the energy ratio peak corresponding represent the common characteristic subspace to this state. Each state signal is reconstructed by inverse TQWT with the specific and common subspace characteristic subspaces. The initial and reconstructed signal samples are represented in Fig. 10.
With regard to these five reconstructed signals in  above and below the zero value. However, the oscillations of the interictal state in Figs. 10(j) and 10(k) are irregular and wider in amplitude than the others. At the same time, these oscillations are more complex than those in the interictal period. Undeniably, our method extracts specific features of episodic EEG.

2) Revised Tunable Q-Factor Wavelet Transform of Bonn
Database in Different Classifiers: Following this, the features of the signal are extracted by selecting suitable subbands based on the distribution of subband energy ratios as a criterion. The subbands {7, 8,9,11,12, 13} selected for the BONN epileptic EEG signals correspond to a specific epileptic wavelet subspace {W i , i = 7, 8, 9, 11, 12, 13}. For comparison with other methods of feature extraction, the dimensionality of the features extracted is kept consistent. In these feature extractors, the energy of subband is extracted to constitute the feature vector. Five classifiers are used to train these feature data. The classifier accuracy is a performance evaluation. Using the A-C-E experimental group as an example, six feature extractor are compared in the Bonn database. Fig. 11 shows the performance of these feature extractors in different classifiers.
In detail, the designated evaluation values for the A-C-E experimental groups are shown in Table IV. Our proposed RTQWT was compared with five feature extractors, FT, EMD, DWT, CWT and TQWT. Among these feature extractors, EMD and FT achieved the worst performance in detecting epilepsy, indicating that the decomposition of the epileptic EEG signal by the EMD and FT methods was not sufficient and the detailed features of epilepsy were incompletely extracted. In the wavelet feature extractor, the proposed RTQWT excelled in all cases and was also able to distinguish epileptic states under all five different classifiers. In particular, among the DT classifiers, the RTQWT had the highest epilepsy classification performance of 97.7%. For the other wavelet feature extractors, DWT and CWT were limited by a constant Q-factor and the oscillations of the wavelets were not compatible with the different fluctuations of epilepsy. For the TQWT wavelets, similar results were observed due to the lack of a criterion for Q-factor. As a result, DWT, CWT and TQWT gave slightly inferior results to RTQWT. The successful application of RTQWT in these classifiers illustrates the effectiveness and superiority of RTQWT in identifying epilepsy.  Except for the A-C-E experimental group, the other four groups in the Bonn database are tested to prove the effectiveness of our proposed method. The results of the four groups are presented in Table IV. In these four experimental groups, the most predominant result is achieved using our proposed RTQWT method. From the values in Table IV, we obtain  several conclusions: 1) To compare the six feature extractors, we compare the accuracy of the feature data after feature extraction using five different classifiers. Table IV shows that the best performance is achieved using the RTQWT. With respect to the training of five different datasets, the best results on all datasets are achieved using the RTQWT, which generally has better accuracy than the other feature extractors by 1%. Among the six feature extractors, the worst performance results, with accuracy rates that are significantly lower than those of the other methods, are obtained using the EMD and FT. For the wavelet transform methods, the accuracy of the CWT is higher than that of the DWT by 1.4% ∼ 4% due to the continuity of CWT wavelets. However, the constant Q-factor hinders the decomposition of epileptic EEG signals by the DWT and CWT, so the DWT and CWT are less effective than the RTQWT. Overall, all the results reflect that the RTQWT method is superior to the other five methods in decomposing epileptic EEG signals, reflecting the superiority of the RTQWT.
2) Comparing the results of the models of the different classifiers in Table IV with those of the RTQWT feature extractor, it can be found that the best performance under different databases is generally achieved using the DT classifier. On these five experimental databases, an improved accuracy of 1.0 ∼ 8.0% is obtained using the DT classifier over the other classifiers. Compared to the NB classifier, the recognition process of epileptic features is optimized on the A-C-E, A-D-E and AB-CD-E databases, and the accuracy is improved by 3.7 ∼ 10.6%. Similarly, it is observed that the DT outperformed the other three classifiers with respect to the classification results. Thus, the decision tree classifier can further improve the classification of epileptic EEG features extracted by the RTQWT.
3) The RTQWT generally outperforms the other feature extractors in the identification of different epileptic EEG signal datasets. However, we note that all six feature extractors perform poorly on the AB-CD-E database. This may be due to the uneven distribution of the number of epilepsy data in the three Bonn categories. However, the highest accuracy is still achieved using the RTQWT with the other feature extraction methods. For the AB-CD-E database, higher results are obtained using the RTQWT feature extraction method than the other feature extractor methods by 1.2 ∼ 18.4%. The excellent performance of the RTQWT feature extraction method for epilepsy EEG signal identification on different databases has validated the robustness of this feature extractor.
According to the results of each classifier on different Bonn datasets in Table IV and Fig. 11, the decision tree was the best for classification of epilepsy EEG signals after RTQWT reconstruction. To further validate the superiority of RTQWT in epilepsy EEG signal feature extraction, RTQWT was combined with other tree models to conduct experiments on these five datasets. The tree models used in the experiments included gradient boosting decision tree(GBDT) and eXtreme gradient boosting(XGBoost), and the experiments were validated using a ten-fold crossover and repeated 50 times, and the mean and standard deviation of all the results were taken as the evaluation metrics of the models. Table V shows the results of the models combining RTQWT with decision trees, GBDT and XGBoost for classification on five different datasets from Bonn. The following conclusions can be drawn from the results in Table V. 1) RTQWT performs best on Bonn database under different tree models. The accuracy of RTQWT combined with DT, GBDT and XGBoost models is improved by 1.0% to 22.0% over the other five feature extraction methods combined with tree models. The superior results of RTQWT combined with GBDT and XGBoost models indicate that the RTQWT feature extraction method can be combined with different tree models to fully achieve good recognition results.
2) The RTQWT method combined with different tree models works best among all feature extraction methods for different datasets. For the A-D-E and AB-CD-E datasets, XGBoost works the best among all classifiers, with improvements of 0.1% to 4.6% compared to DT and GBDT. For the B-C-E dataset, the best accuracy of 97.7% is achieved using the DT classifier. For the other two datasets, GBDT performs better, with an accuracy improvement of 1.5% ∼ 2.5% compared to DT and XGBoost, respectively.
3) For different tree models, DT, GBDT and XGBoost combined with RTQWT all outperform the other feature extraction combined models in terms of classification. For the B-C-E dataset, the best classification result is achieved using DT; GBDT is more suitable for the A-C-E and A-D-E datasets. The XGBoost combined with RTQWT model performs well on all datasets, especially on the first four datasets.

V. CONCLUSION
In this paper, a new revised TQWT method for epilepsy feature detection is proposed and successfully applied to the Bonn database. The TQWT parameters of the Q-factor and redundancy are optimized on the basis of a new weighted normalized entropy. The reconstructed signals are obtained by the selection of unique and common feature subspaces with energy ratio distributions. These signals are passed through the classifier for epilepsy detection. In this process, the weighted normalized entropy of the minimized TQWT subbands corresponds to the minimum loss of the TQWT signal decomposition. Then, for the subbands obtained from the RTQWT decomposition, the most discriminative subbands are selected according to the energy ratio distribution, extracting the unique and common feature subspaces between different types and removing redundant information at the same time. Finally, these signals are recognized with different classifiers to verify the effectiveness and robustness of the RTQWT. Our proposed method is validated using five experimental groups from both Bonn databases. For the A-C-E dataset, the maximum accuracy of identifying the Bonn signals with the decision tree is 99.8% with a standard deviation of 0.53%.
The major innovative features of the proposed methods are listed as follows: (1) The TQWT is applied to decompose nonlinear signals with the new proposed weighted normalized entropy to optimize the Q-factor and redundancy. This method ensures that the signal decomposition is sufficient.
(2) The distribution of the energy ratio presents the optimal subbands of various signals and contributes to mining for specific and common characteristic subspaces. The signals containing these characteristic subspaces are more conducive to subsequent classification.
(3) The feature extractor RTQWT combined with the classifier of the decision tree can further optimize the process of signal identification. The specific characteristics in signals are extracted via RTQWT. The decision tree based on the nonlinear structure identifies the specific features extracted by the RTQWT.
The highest accuracy with the lowest standard deviation for the five experimental groups is achieved using the RTQWT with DT. The accuracy is improved by 4.8% ∼ 18.6% compared to the FT, EMD, DWT, CWT and TQWT. Satisfactory classification results for different datasets are achieved using the RTQWT with other tree models. Among them, the RTQWT model combined with XGBoost shows the best performance, with an accuracy above 95% on the four datasets and the highest accuracy of 89% on the AB-CD-E dataset. The effectiveness and robustness of the algorithm are confirmed via extensive experiments with different classifiers and databases.

VI. FUTURE WORK
The revised tunable Q-factor wavelet transform method is utilized for epileptic EEG signal detection in this paper. This method accurately extracts the fluctuating post-reconstruction signal of the epileptic signals, and it significantly improves the detection rate of epileptic seizures. We attempt to extend the approach of this paper to detection tasks with different patient seizure types and varying degrees of artifacts. This will allow RTQWT to cope with different seizure types. Future work considers extending the universality of RTQWT for detecting epilepsy. The ability of RTQWT to detect many different seizures is enhanced by embedding RTQWT into deep learning.