Chapter 4 Epileptic Seizure Detection Algorithm
4.3 EEG Data for Training and Testing
4.3.1 Training Phase
The purpose of training is to determine a fitting model which contains four coefficients and four thresholds for each subject. Fig. 4.13 shows the procedure of training phase.
Continuous EEG signals of each rat are recorded for marking and training. After recorded, EEG signals which correspond to seizures (SWD) and non-seizures (WK, SWS, and artifact) are marked by specialist. The marked events as mentioned above are used to extract CM, Band1, Band2, and Band0 values. After that, we start to train eight parameters including four coefficients and four thresholds. The following are the details of EEG data training.
EEG recording
EEG data marking
EEG data training Seizure(SWD) Non-seizure(WK, SWS, Artifact)
Acquire 4-coefficient and 4-threshold 4-coefficient (CM, Band1, Band2, constant)
4-threshold (T1, T2, THsws, TLsws) Off-Line
Training Phase
in Computer
EEG data selection
CM and FFT computation
LLS 4-coefficient computation
4-threshold search
Fig. 4.13 Procedure of training phase.
First, we randomly select the EEG segments of four states, and the ratios of the segments corresponding to SWD, WK, SWS, and the artifact must be 3:1:1:1 as shown in Fig. 4.14.
Second, we execute CM and FFT computation to obtain CM, Band1, Band2, and Band0 values. Third, combined feature substitute the X of Eq. ( 41 ), and desired output substitutes the y of Eq. ( 41 ) like Eq. ( 42 ). Then, the optimal coefficients ˆ
can be determined. Fourth,the optimal coefficients ˆ
are applied for Eq. ( 43 ), where three features are obtained from training data. Then, we search the optimal thresholds from LLS and Band0 values in order to recognize a seizure event. The flowchart of seizure determination is shown in Fig. 4.15, and we test many sets of thresholds in detection rate and false detection rate for finding the most optimal thresholds.64
64 64
64
64
… …
CM CM CM CM CM
Band1 Band1 Band1 Band1 Band1 Band2 Band2 Band2 Band2 Band2
Time
#
CM Band1 Band2
Feature extraction
#
#
#
64
SWD segment WK segment SWS segment artifact segment
0 0 1 1 1 0
Desired
output output of LLS
Input of LLS
Band0 Band0 Band0 Band0 Band0 Band0
Fig. 4.14 Feature extraction and LLS classifier training.
TLSWS<Band0 &&
Band0<THSWS
WK
SWS
Seizure alarm LLS >= T1
LLS >= T2
Y
Y Start
Y N
Fig. 4.15 The flowchart of seizure determination.
In previous work, four thresholds are obtained by using exhaustive key search. In Fig.
4.16 (a), we do not calculate the distribution of seizure’s and non-seizure’s values of LLS and Band0, and we use every set of 4-threshold to test detection rate and false detection. We need (MN)2 times of iterations to find the best thresholds. As a result, original method wastes a lot of time on parameter determination. To speed up parameter determination, it is proposed that using the mean and the multiples of standard deviation finds four thresholds rapidly. We calculate the distribution of seizure’s and non-seizure’s values of LLS and Band0. According
to the step as mentioned above, we only need
M N 2
The value of LLS
… … M times to search T1 value
M times to search T2 value
The value of Band0
… …
N times to search TLSWS value
N times to search THSWS value
… …
The value of LLS
The value of Band0
Mean Standard deviation
M/m times to search T1 value
… … … …
… …
… …
Standard deviation Mean
M/m times to search T2 value
Mean Standard deviation
… … … …
N/n times to search TLSWS value
… …
… …
Standard deviation Mean
N/n times to search THSWS value
(a) (b)
Fig. 4.16 (a) Original search for 4-threshold, (b) Proposed search for 4-threshold.
The following are the steps of the fast parameter determination method. Moreover, the flowchart of fast parameter determination method is depicted in Fig. 4.17.
1) The four coefficients of Eq. ( 43 ) is substituted for optimal coefficients ˆ
, and wewhere i is multiple of standard deviation. We choose a real number to substitute i for calculating T1, and the detection rate of our system is determined in this step.
3) We compute the mean and the standard deviation of actual SWD’s Band0 value as depicted in Fig. 4.18 (a), so THSWS can be written
TH
SWS SWD's Band 0 j SWD's Band 0
( 45 ) where j is multiple of standard deviation. We choose a real number to substitute j for calculating THSWS, and the false detection rate is reduced in this step.4) After executing three steps as mentioned above, we compute the mean and the standard deviation of FP’s LLS value and FP’s Band0 value as shown in Fig. 4.18 (c). T2 and TLSWS can be written
T 2 FP's LLS k FP's LLS
( 46 )
TL
SWS FP's Band 0 l FP's Band 0
( 47 ) where k and l are multiple of standard deviation. We choose real numbers separately to substitute k and l for calculating T2 and TLSWS, and the false detection rate is also reduced in this step.5) We test the detection rate and the false detection rate for 4-threshold which is determined by Step(2) to Step(4).
6) Changing the real number of i and j, we iterate form Step (2) to Step (5). In Step (4), we also change the real number of k and l, we iterate form Step (4) to Step (5). Finally, we can select the best threshold from the test in Step (5).
T1=t1i
THSWS=thswsj
k<=M/m (5) Calculate Performance
End
Start to find T1, T2, THSWS,TLSWS
i=0, j=0, k=0, l=0
i=i+1 (1) Calculate LLS
(2) Calculate T1' T1'=[t11 t12 … t1i … t1(M/m)]
(4) Calculate T2' T2'=[t21 t22 … t2k … t2(M/m)]
Calculate TLSWS'
TLSWS'=[tlsws1 tlsws2 … tlswsl … tlsws(N/n)] (3) Calculate THSWS'
THSWS'=[thsws1 thsws2 … thswsj … thsws(N/n)]
k=k+1
T2=t2k
TLSWS=tlswsj
i<=M/m l=l+1 j=j+1
l<=N/n
j<=N/n l=0
k=0
j=0 Y
N
Y
N
N Y
Y
N
Fig. 4.17 Flowchart of fast parameter determination method.
FP
True Negative: Actual non-seizure, tested non-seizure False Positive: Actual non-seizure, tested seizure True Positive: Actual seizure, tested seizure
(a) (c)
(b) (d)
Fig. 4.18 (a) Original data, (b) Determine T1, (c) Determine THSWS, (d) Determine T2 and TLSWS.