i-EEG: A Software Tool for EEG Feature Extraction, … · i-EEG: A Software Tool for EEG Feature...

18
43 i-EEG: A Software Tool for EEG Feature Extraction, Feature Selection and Classification Baha ŞEN Computer Engineering Department, Yıldırım Beyazıt University, Ulus, Ankara, TURKEY Musa PEKER Computer Engineering Department, Karabuk University,78050, Karabuk, TURKEY Abdulkadir BUT Department of Anesthesiology and Reanimation, Yıldırım Beyazıt University, Cankaya, Ankara, TURKEY Abstract Computer-aided diagnosis of some brain disorders using EEG signals, is an issue of growing concern in recent years. In this study, a software which is developed from EEG data is presented for depth of anesthesia and diagnosis of disease. Developed software offers a different approach for the aspect of combining processes of data cleaning, feature extraction, feature selection and classification together. Software is developed using the C# programming language which is one of .NET programming languages. With the software, 4-stage procedures are performed on the EEG signal. For the first stage, filtering and cleaning of EEG data is ensured. For this stage, filtering algorithms are used. At second stage, attribute extraction process is done for determination of the significant information from EEG data. At this stage, 40 attribute values that widely preferred in literature can be obtained. At third stage (selection stage), attribute selection is carried out to ensure detection of effective attributes among all the attributes. At the selection stage, the user can select any algorithm that she/he wants among six different algorithms. These algorithms are fisher scoring, t-test, gini, fast correlation based filter (FCBF), minimum redundancy maximum relevance (mRMR) and reliefF, respectively. At final stage, effective attributes are presented as input to the classification algorithms. The user can choose five different classification algorithms for the classification stage. These algorithms are feed-forward neural network, radial basis function neural network, C4.5 decision tree, random forest algorithm and support vector machines, respectively. The software which has a visual interface is very easy to use and designed to be user-friendly. An application sample is given with using the software developed in this study. In the application sample, applications were made on EEG data in order to determine depth of anesthesia. Results can be obtained as statistical in this software. It also is possible to follow the performance results graphically. After user testing completed, it is aimed to share the software free of charge as open source software project. Keywords: Computer-aided diagnosis, EEG, software tool, feature extraction, feature selection, classification

Transcript of i-EEG: A Software Tool for EEG Feature Extraction, … · i-EEG: A Software Tool for EEG Feature...

Page 1: i-EEG: A Software Tool for EEG Feature Extraction, … · i-EEG: A Software Tool for EEG Feature Extraction, Feature Selection and Classification 46 3.2 Cleaning of EEG Data and Filtering

43

i-EEG: A Software Tool for EEG Feature Extraction, Feature Selection and Classification Baha ŞEN

Computer Engineering Department, Yıldırım Beyazıt University, Ulus, Ankara, TURKEY

Musa PEKER

Computer Engineering Department, Karabuk University,78050, Karabuk, TURKEY

Abdulkadir BUT

Department of Anesthesiology and Reanimation, Yıldırım Beyazıt University, Cankaya, Ankara, TURKEY

Abstract

Computer-aided diagnosis of some brain disorders using EEG signals, is an issue of growing concern in recent years. In this study, a software which is developed from EEG data is presented for depth of anesthesia and diagnosis of disease. Developed software offers a different approach for the aspect of combining processes of data cleaning, feature extraction, feature selection and classification together. Software is developed using the C# programming language which is one of .NET programming languages. With the software, 4-stage procedures are performed on the EEG signal. For the first stage, filtering and cleaning of EEG data is ensured. For this stage, filtering algorithms are used. At second stage, attribute extraction process is done for determination of the significant information from EEG data. At this stage, 40 attribute values that widely preferred in literature can be obtained. At third stage (selection stage), attribute selection is carried out to ensure detection of effective attributes among all the attributes. At the selection stage, the user can select any algorithm that she/he wants among six different algorithms. These algorithms are fisher scoring, t-test, gini, fast correlation based filter (FCBF), minimum redundancy maximum relevance (mRMR) and reliefF, respectively. At final stage, effective attributes are presented as input to the classification algorithms. The user can choose five different classification algorithms for the classification stage. These algorithms are feed-forward neural network, radial basis function neural network, C4.5 decision tree, random forest algorithm and support vector machines, respectively. The software which has a visual interface is very easy to use and designed to be user-friendly. An application sample is given with using the software developed in this study. In the application sample, applications were made on EEG data in order to determine depth of anesthesia. Results can be obtained as statistical in this software. It also is possible to follow the performance results graphically. After user testing completed, it is aimed to share the software free of charge as open source software project.

Keywords: Computer-aided diagnosis, EEG, software tool, feature extraction, feature selection, classification

Page 2: i-EEG: A Software Tool for EEG Feature Extraction, … · i-EEG: A Software Tool for EEG Feature Extraction, Feature Selection and Classification 46 3.2 Cleaning of EEG Data and Filtering

i-EEG: A Software Tool for EEG Feature Extraction, Feature Selection and Classification

44

1. Introduction

EEG signals are received with the help of electrodes on the scalp and reflect the collective activity of brain cells (Sen & Peker 2013). In general, EEG composed of four main waveforms. These are alpha wave (8 ~ 13 Hz), beta wave (13 ~ 30 Hz), delta wave (0 ~ 4 Hz) and theta wave (4 ~ 7 Hz). These wave types in EEG signal vary in case of any pathology case. Sometimes it is difficult to identify the components of EEG sign showing instant change (Artan & Yazgan 2008, Peker & Sen 2013). EEG data are analyzed visually by a specialist in a clinic. This process is quite stressful and tiring for the eyes and the mind. EEG data were recorded for hours or even for days, are analyzed in the form of 10-second frames passing the computer screen (Artan & Yazgan 2008). EEG data were reviewed by specialists with different educational background, may lead to inconsistent data records (Kolb & Whishaw 2010). For all these reasons, a computer-aided system is of utmost importance to help the specialists. The use of computer-aided diagnosis systems is increasing in recent years for detection of neurological diseases and issues related to the depth of anesthesia. In this study, methods with successful results in the literature were examined for classification of EEG data and software which includes those methods was developed. Unlike studies in the literature, developed software can calculate 44 attribute value in five different categories. Among the main advantages of the software, it includes 6 different algorithms during attribute selection stage. Also doing some operations like cleaning the data, attributes acquisition, effective attribute selection and classification process under a single roof adds a special importance to the study. The software which has a visual interface is very easy to use and designed to be user-friendly.

2. Data Acquisition

The data used in this study were obtained from Yıldırım Beyazıt University Faculty of Medicine Hospital. In this study, 20 isoflurane anesthetic drug used cases were included. Duration of anesthesia and operations carried out are different. Patients' age ranged from 30 to 60. Characteristics of data group are as follows:

Range Mean Standard Deviation Age 30-60 47.5 26.3

Weight 45-88 69.5 13.9 Table 1: Characteristics of the data group

Raw EEG signals were acquired using a BIS VISTA monitor (BIS VISTATM version 3.00, algorithm version BIS 4.1, Aspect Medical systems) with standard BIS sensors. Data were exported to a USB drive and transferred to a portable computer for off-line analysis. EEG signal was filtered between 0.1 - 60 Hz and digitized with sampling rate of 128 Hz. Anesthesia data belongs to the six different levels of anesthesia. Therefore, in this study, applications were conducted in order to determine a six-level depth of anesthesia. During the recordings, in order to compare with extracted attributes, BIS index was also recorded from the depth of anesthesia monitoring device. This device has indexing between 0-100 and wakefulness represents with

Page 3: i-EEG: A Software Tool for EEG Feature Extraction, … · i-EEG: A Software Tool for EEG Feature Extraction, Feature Selection and Classification 46 3.2 Cleaning of EEG Data and Filtering

GAU Journal of Soc. & App. Sciences vol. 6, issue 10

45

the value of 100. Classified anesthesia levels in this study and the corresponding levels of BIS values are presented in Table 2.

Ane

sthe

tic

Dep

th L

evel

s Deep Anesthesia BIS Index: 0-25 6 BIS Index: 25-40 5

Moderate Anesthesia BIS Index: 40-50 4 BIS Index: 50-60 3

Light Anesthesia BIS Index: 60-80 2 Awake BIS Index: 80-100 1

Table 2. Scoring criteria state levels of anesthesia (Gifani et. al. 2007)

3. EEG Signal Processing Software

Recommended software was developed using C# and MATLAB programming languages. With the software, operations are carried out as 4-stage on the EEG signal. For the first stage, filtering and cleaning of EEG data is assured. At this stage, filtering algorithms are used. At second stage, feature extraction process is carried out. At this stage, 44 feature values can be obtained. At third stage, feature selection stage is carried out to ensure detection of effective feature among all the features. During the feature selection stage, user can select any algorithm that she/he wants among six different algorithms. These algorithms are fisher scoring, t-Test, gini, fast correlation based filter (FCBF), mRMR and reliefF, respectively. At last stage, effective attributes are presented as input to the classification algorithms. The user can choose five different classification algorithms during the classification stage. These algorithms are feed-forward neural network, C4.5 decision tree, random forest algorithm, support vector machines and radial basis neural network, respectively. An application example is given on developed software. In the application example, in order to determine the depth of anesthesia applications were made on EEG data. In this way, it is aimed to do better promotion for the software.

3.1 The Interface of Developed Software

The interface of developed software is as in Figure 1. As can be seen from the figure, all operations were assembled on a single window. The user can select any action from this window.

Figure 1: Screen interface of developed system

Page 4: i-EEG: A Software Tool for EEG Feature Extraction, … · i-EEG: A Software Tool for EEG Feature Extraction, Feature Selection and Classification 46 3.2 Cleaning of EEG Data and Filtering

i-EEG: A Software Tool for EEG Feature Extraction, Feature Selection and Classification

46

3.2 Cleaning of EEG Data and Filtering

MATLAB programming language were used during the preparation of EEG data. Operations carried out with MATLAB codes were integrated into the C # programming language. In the software, varieties of filters are available to reduce the impact of noise and artifacts in EEG signals. These filters are 0.1-60 Hz band-pass filters and the smoothing filter. Segmentation process is implemented at final stage in order to make operations easier on long EEG signals.

Figure 2 shows the situation of original EEG signal after filtering and cleaning operations. Figure 3 shows the frequency spectrum of the original and the filtered signals. As can be seen in Figure 3, the original signal frequency varies between 0.1-250 Hz. Frequency distribution of the filtered signal varies between 0.1-55 Hz. Figure 4 shows the segmentation process. Long EEG signal is divided into segments with specific example values.

Figure 2: EEG signal going through stages of filtering and smoothing filter between 0-55 Hz.

Page 5: i-EEG: A Software Tool for EEG Feature Extraction, … · i-EEG: A Software Tool for EEG Feature Extraction, Feature Selection and Classification 46 3.2 Cleaning of EEG Data and Filtering

GAU Journal of Soc. & App. Sciences vol. 6, issue 10

47

Figure 3: Frequency distribution of the EEG signal before filtering stage - frequency distribution of EEG signal after filtering stage

Figure 4: Division of EEG signal sample into 30 s epochs

3.3 Feature Selection

The software window developed for the feature selection phase can be seen in Figure 5. Data type can be selected with this software. Feature selection algorithm is selected from method selection section. As shown in Figure 5, there are 6 different feature selection algorithm. Furthermore, the developed software provides information on total processing time. Effective features and order of these features are able to seen on the result screen.

Page 6: i-EEG: A Software Tool for EEG Feature Extraction, … · i-EEG: A Software Tool for EEG Feature Extraction, Feature Selection and Classification 46 3.2 Cleaning of EEG Data and Filtering

i-EEG: A Software Tool for EEG Feature Extraction, Feature Selection and Classification

48

Figure 5: Feature selection stage

3.4 Classification Stage

For classification stage, there are 5 different classification algorithms. Separate form design and software has been developed for each algorithm. With which algorithm the user wants to perform the classification operation, user can click on it on home page to perform classification.

3.4.1 Feed-Forward Neural Network

The software developed for neural network consists of five windows. Data selection, settings, training operations, results screen and graphical display are customized and presented at separate windows.

Figure 6: Data selection screen

Page 7: i-EEG: A Software Tool for EEG Feature Extraction, … · i-EEG: A Software Tool for EEG Feature Extraction, Feature Selection and Classification 46 3.2 Cleaning of EEG Data and Filtering

GAU Journal of Soc. & App. Sciences vol. 6, issue 10

49

In Figure 6, the set of data to be processed is selected. The length of the data files can be txt, csv or xls. In Figure 7, the parameter settings are performed. On the area number 1, hidden layer neuron number and hidden layer activation functions can be selected. On the area number 2, output layer activation function can be selected. Number of neurons for input layer and output layer are chosen automatically depending on the selected data type. On the area number 3, training parameters are determined for neural network. In this area the number of iterations, the learning rate, minimum error rate and momentum coefficient value can be entered.

In Figure 8, neural network training operations are carried out. On the screen No.1, number of data determined in training and testing clusters. On the screen No. 2, when “Train” button is clicked the training process begins. In addition, stage of the process and whether completed or not, can be seen on this screen. It is possible to see the performance results on Figure 9. From this screen, the accuracy rate, number of accurate predictions, number of wrong predictions and the smallest error values can be seen. In Figure 10, changes in the error rates can be observed graphically depending on the number of iterations.

Figure 7: Setting window

Page 8: i-EEG: A Software Tool for EEG Feature Extraction, … · i-EEG: A Software Tool for EEG Feature Extraction, Feature Selection and Classification 46 3.2 Cleaning of EEG Data and Filtering

i-EEG: A Software Tool for EEG Feature Extraction, Feature Selection and Classification

50

Figure 8: Training operations window

Figure 9: The result screen

Page 9: i-EEG: A Software Tool for EEG Feature Extraction, … · i-EEG: A Software Tool for EEG Feature Extraction, Feature Selection and Classification 46 3.2 Cleaning of EEG Data and Filtering

GAU Journal of Soc. & App. Sciences vol. 6, issue 10

51

Figure 10: Iteration-error graph

3.4.2 Decision Tree

C4.5 was preferred as decision tree algorithm. The developed software for decision tree consists of 5 windows. Data selection, settings, training operations, results screen and graphical display are customized and presented at separate windows. In Figure 11, there are four sections. On the screen No. 1, data selection process is carried out. How distribution of data is carried out also can be selected on this screen. For data distribution, 3- fold, 5- fold and 10- fold cross-validation methods are supported. On the screen number 2, the data are presented from the selected data set. Thanks to the button on area number 3, program is started up. On the area number 4, information is provided for processing time.

Page 10: i-EEG: A Software Tool for EEG Feature Extraction, … · i-EEG: A Software Tool for EEG Feature Extraction, Feature Selection and Classification 46 3.2 Cleaning of EEG Data and Filtering

i-EEG: A Software Tool for EEG Feature Extraction, Feature Selection and Classification

52

Figure 11: Data entry screen and settings

In Figure 12, structure of the decision is given for decision tree. In Figure 13, the results obtained are listed with different performance evaluation criteria. On screen number 1, error rates are listed as a result of each fold. On screen number 2, the results obtained are listed with different performance evaluation criteria. On screen number 3, confusion matrix is presented. In Figure 14, the results are listed according to the three key performance evaluation criterias. These criterias are accuracy rate, specificity and sensitivity, respectively. At the last stage in Figure 15, for each output rate, accuracy rate, specificity and sensitivity rates are presented graphically.

Figure 12: Decision structure of the decision tree

Page 11: i-EEG: A Software Tool for EEG Feature Extraction, … · i-EEG: A Software Tool for EEG Feature Extraction, Feature Selection and Classification 46 3.2 Cleaning of EEG Data and Filtering

GAU Journal of Soc. & App. Sciences vol. 6, issue 10

53

Figure 13: Performance evaluation screen

Figure 14: Performance evaluation screen – 2

Page 12: i-EEG: A Software Tool for EEG Feature Extraction, … · i-EEG: A Software Tool for EEG Feature Extraction, Feature Selection and Classification 46 3.2 Cleaning of EEG Data and Filtering

i-EEG: A Software Tool for EEG Feature Extraction, Feature Selection and Classification

54

Figure 15: Graphical presentation of the results

3.4.3 Random Forest Algorithm

The developed software for Random Forest algorithm consists of five windows. Data selection, settings, training operations, results screen and graphical display are customized and presented at separate windows. In Figure 16, there are four sections. On the screen No. 1, data selection operation is carried out. Also, how distribution of data is carried out can be selected on this screen. For the software, 3- fold, 5 - fold and 10 - fold cross-validation methods are supported. On the screen number 2, the data are presented from the selected data set. Thanks to the button on area number 3, program is started up. On the area number 4, information is provided related to processing time. In Figure 17, decision structure of decision tree is given.

Figure 16: Data entry screen and settings

Page 13: i-EEG: A Software Tool for EEG Feature Extraction, … · i-EEG: A Software Tool for EEG Feature Extraction, Feature Selection and Classification 46 3.2 Cleaning of EEG Data and Filtering

GAU Journal of Soc. & App. Sciences vol. 6, issue 10

55

Figure 17: Decision structure of the random forest algorithm

In Figure 18, the results obtained are listed in accordance with different performance evaluation criteria. On screen number 1, error rates are listed for a result of each fold. On screen number 2, the results obtained are listed with different performance evaluation criteria. On screen number 3, confusion matrix is given. In Figure 19, the results are listed according to the three important performance evaluation criterias. These criterias are accuracy rate, specificity and sensitivity, respectively. At the final stage in Figure 20, for each output value, accuracy rate, specificity and sensitivity rates are presented graphically.

Figure 18: Performance evaluation screen

Page 14: i-EEG: A Software Tool for EEG Feature Extraction, … · i-EEG: A Software Tool for EEG Feature Extraction, Feature Selection and Classification 46 3.2 Cleaning of EEG Data and Filtering

i-EEG: A Software Tool for EEG Feature Extraction, Feature Selection and Classification

56

Figure 19: Performance evaluation screen – 2

Figure 20: Graphical presentation of the results

3.4.4 Support Vector Machines

The software developed for support vector machines consists of three windows. Data selection, settings and result screens are customized and presented in separate windows. In Figure 21, data selection operation is carried out.

Page 15: i-EEG: A Software Tool for EEG Feature Extraction, … · i-EEG: A Software Tool for EEG Feature Extraction, Feature Selection and Classification 46 3.2 Cleaning of EEG Data and Filtering

GAU Journal of Soc. & App. Sciences vol. 6, issue 10

57

Figure 21: Data selection screen

Figure 22: Settings window and selection of core function

In Figure 22, settings are carried out for support vector machines. Distribution of data is determined on the window No.1. In the example, data set determined as 70% education data, and 30% test data. On the window No.2, core function can be selected. On screen number 3, information is given related to processing time and the stage of the process. Thanks to the

Page 16: i-EEG: A Software Tool for EEG Feature Extraction, … · i-EEG: A Software Tool for EEG Feature Extraction, Feature Selection and Classification 46 3.2 Cleaning of EEG Data and Filtering

i-EEG: A Software Tool for EEG Feature Extraction, Feature Selection and Classification

58

button on the screen number 4, the algorithm starts to work. Thanks to the screen number 5, operation of the algorithm can be stopped. In figure 23, the results obtained are presented. On screen number 1, estimated output values and the actual output values obtained are given. On screen number 2, accuracy rates as a result of algorithm is started up and success rates are given.

Figure 23: Result screen

3.4.5 Radial Basis Function Network

The developed software for radial basis function network consists of two windows. Data selection + settings and results screen are customized and presented at separate windows. In Figure 24, there are four sections. On the screen No. 1, data selection operation is carried out. On the screen number 2, the data are presented from the selected data set. On the area number 3, training parameters are determined for neural network. In this area the number of samples, number of attribute, number of center and spread value can be entered. Thanks to the button on area number 4, program is started up.

In figure 25, the results obtained are presented. On screen number 1, the results are listed according to the three important performance evaluation criterias. On screen number 2, confusion matrix is presented. On screen number 3, estimated output values and the actual output values obtained are given.

Page 17: i-EEG: A Software Tool for EEG Feature Extraction, … · i-EEG: A Software Tool for EEG Feature Extraction, Feature Selection and Classification 46 3.2 Cleaning of EEG Data and Filtering

GAU Journal of Soc. & App. Sciences vol. 6, issue 10

59

Figure 24: Data entry screen and settings

Figure 25: Result screen

4. Conclusions

In this study, a developed software for EEG data processing is presented. Developed software offers a different approach for the aspect of combining processes of data cleaning, attribute

Page 18: i-EEG: A Software Tool for EEG Feature Extraction, … · i-EEG: A Software Tool for EEG Feature Extraction, Feature Selection and Classification 46 3.2 Cleaning of EEG Data and Filtering

i-EEG: A Software Tool for EEG Feature Extraction, Feature Selection and Classification

60

extraction, attribute selection and classification together. As shown on the result charts, high success rates have been achieved on the anesthesia data. Attributes are one of the most important reasons for this, obtained from the feature extraction stage. During the feature selection stage, quality set of feature obtained with the detection of effective features. During the experiments, 44 features are presented as introduction without the feature reduction. When we just look at the experiment results, radial basis function network appears to be the most successful algorithm. With this algorithm, anesthesia data that consists of six different levels is classified by 94.93% success rate.

It is aimed to use this software for future studies in order to do operations on different EEG data. CUDA parallel processor is also included at the classification stage with an aim to create a system that works fast. The developed software can also be used with small additions for other biomedical signals. After user testing completed, it is aimed to share the software free of charge as open source software project.

References:

Sen B, Peker M, 2013. Novel approaches for automated epileptic diagnosis using FCBF feature selection and classification algorithms. Turkish Journal of Electrical Engineering & Computer Sciences, volume 1, issue 18, pp. 2092-2109.

Artan RB, Yazgan E, 2008. Epileptic seizure detection from SEEG data by using higher order statistics and spectra. itü dergisi, volume 7, issue 6, 102-111.

Peker M, Sen B, 2013. A new complex-valued intelligent system for automated epilepsy diagnosis using EEG signals. Global Journal on Technology: 3rd World Conference on Information Technology, volume 4, pp. 1121-1128.

Kolb B, Whishaw IQ, 2010. Fundamentals of human neuropsychology. 6th edition. Worth Publishers, New York.

Gifani P, Rabiee HR, Hashemi MH, Taslimi P, Ghanbari M, 2007. Optimal fractal-scaling analysis of human EEG dynamic for depth of anesthesia quantification. Journal of the Franklin Institute, volume 344, issue 3, pp. 212–229.