PyEEG A Python Module for EEG Feature ExtractionOutline Introduction PyEEGFuture workQuestions?...

18
Outline Introduction PyEEG Future work Questions? PyEEG A Python Module for EEG Feature Extraction Forrest Sheng Bao 1,2 and Christina R. Zhang 3 1 Department of Computer Science, Texas Tech University, Lubbock, Texas 2 Department of Electrical Engineering, Texas Tech University, Lubbock, Texas 3 Department of Physiology, McGill University, Canada Jun. 30, 2010, Scipy 2010, UT, Austin, Texas

Transcript of PyEEG A Python Module for EEG Feature ExtractionOutline Introduction PyEEGFuture workQuestions?...

  • Outline Introduction PyEEG Future work Questions?

    PyEEGA Python Module for EEG Feature Extraction

    Forrest Sheng Bao1,2 and Christina R. Zhang3

    1 Department of Computer Science, Texas Tech University, Lubbock, Texas2 Department of Electrical Engineering, Texas Tech University, Lubbock, Texas

    3 Department of Physiology, McGill University, Canada

    Jun. 30, 2010, Scipy 2010, UT, Austin, Texas

  • Outline Introduction PyEEG Future work Questions?

    Outline

    1 IntroductionFeature Extraction in Neurological Signal ProcessingEEG: The Name of The GameEEG Reading in Naked EyesA Case Study: Features may be betterWhy PyEEG?

    2 PyEEGMain FrameworkEEG Pre-processingFeaturesBasic Usage

    3 Future work

    4 Questions?

  • Outline Introduction PyEEG Future work Questions?

    Feature Extraction in Neurological Signal Processing

    Over the past decade, computer-aided diagnosis (CAD) systemsbased on EEG have emerged in the early diagnosis of severalneural diseases such as Alzheimer’s disease [1] and epilepsy [2].A key component in most such CAD systems is to characterizeEEG signals into certain features, a process known as featureextraction.EEG features can come from different fields that study timeseries: power spectrum density from classical signal processing,fractal dimensions from computational geometry, entropies frominformation theory, synchrony measures from nonlinear physics,etc.By extracting EEG features, we can use more powerful tools,such as machine learning, to analyze the signal in the next step.

  • Outline Introduction PyEEG Future work Questions?

    EEG: The Name of the Game

  • Outline Introduction PyEEG Future work Questions?

    EEG Reading Cards: The Limit of Our Eyes

  • Outline Introduction PyEEG Future work Questions?

    A Case Study on Epilepsy: Features may be better

    Over 50 million people worldwide suffer from epilepsy.Conventional epilepsy diagnosis may require long-term orrepeated EEG recordings to capture seizures (ictal) or otherepileptic activities. Physicians visually inspect lengthy EEGrecordings - paging through 24-hr waveforms.To help those MDs, research on picking out segments thatphysicians may interest has been under going for quite a while.Recently, researchers have found it promising to use interictal(i.e., non-seizure) EEG records that do not contain particularactivities. We can tell whether a EEG segment is epileptic [3] orwhere the seizure foci are [4], based on EEG features extracted.Futhermore, it is possible to predict the state of the brain bytracking the values of those features. This idea is use by seizurepredition researchers.

  • Outline Introduction PyEEG Future work Questions?

    Why PyEEG?

    The computational analysis to EEG signal as described aboverequires a toolbox to quantify EEG patterns. Turn “The stockwent rocket high” into “NASDAQ increased 5%.”Such a toolbox can be very useful to computational neurosciencecommunity.There is no highly active project as expected out there (e.g.,pbrain, ptsa).We are not aware of an open-source “simple” (simplifying everyaspect of using) Python solution.“Software is like sex; it’s better when it’s free.” (Free as in GPL.)

  • Outline Introduction PyEEG Future work Questions?

    Main Framework

    EEG series

    PyEEGnon-feature

    extraction functions

    feature extraction functions

    feature values

  • Outline Introduction PyEEG Future work Questions?

    Main Framework (cond.)

    PyEEG consists of two sets of functions, EEG pre-processingfunctions, which do not return any feature values, and featureextraction functions that return feature values.Besides standard Python functions, PyEEG only uses functionsprovided by Numpy/SciPy.PyEEG does not define any new data structure, using standardPython and NumPy ones only.The inputs of all functions are time series in form of a list offloating-point numbers and a set of optional feature extractionparameters. Parameters have default values.The output of a feature extraction function is a floating-pointnumber if the feature is a scalar or a list of floating-point numbersif it is a vector.

  • Outline Introduction PyEEG Future work Questions?

    EEG Pre-processing

    Pre-processing: to build new time series from given time seriesfor further computation.PyEEG currently provides two pre-processing functions.embed seq(): to build embedding sequence (from given lagand embedding dimension)first order diff(): to compute first-order differentialsequence. One can build differential sequences of higher ordersby apply first-order differential computing repeatedly.

  • Outline Introduction PyEEG Future work Questions?

    Features

    feature typeRelative Intensity Ratios (RIRs) [3] a 1-D vectorPetrosian Fractal Dimension (PFD) [5] a scalarHiguchi Fractal Dimension (HFD) [6] a scalarHjorth mobility & complexity [7] a 1-by-2 vectorSpectral Entropy (entropy of RIRs) a scalarSVD Entropy [8] a scalarFisher Information [9] a scalarApproximate Entropy (ApEn) [10] a scalarSample Entropy (SampEn) [11] a scalarDetrended Fluctuation Analysis (DFA) [12] a scalar

    More features are coming in PyEEG.No reinvention to the wheel (skewness, etc.).

  • Outline Introduction PyEEG Future work Questions?

    Basic Usage

    SciPy is required to run PyEEG. The latest PyEEG is released as asingle Python script, which includes all functions. So users only needto download and place it under a directory that is in Python modulesearch path, such as the working directory. Example:

    >>>import pyeeg>>> from numpy.random import randn>>> for i in xrange(0,10):... pyeeg.dfa(randn(4096))...0.504734072786672710.533394994455716140.530343544308412460.508443734463756240.51623193683371360.463192796477799760.445155123438676690.44077407030262450.458946724656138840.49135727073171609

  • Outline Introduction PyEEG Future work Questions?

    Future work

    More features.More comprehensive documentations.Unittest for all functions.Faster implementation.File I/O.(Probably) Integration with nipy/pbrainhttp://nipy.sourceforge.net/pbrain/.

    http://nipy.sourceforge.net/pbrain/

  • Outline Introduction PyEEG Future work Questions?

    Questions?

    Licensed under GPL v3 at http://code.google.com/p/pyeeg/

    http://code.google.com/p/pyeeg/

  • Outline Introduction PyEEG Future work Questions?

    Bibliography I

    J. Dauwels, F. Vialatte, and A. Cichocki, “A comparative study ofsynchrony measures for the early detection of Alzheimerâsdisease based on EEG,” Neural Information Processing, pp.112–125, 2008.

    F. S. Bao, D. Y.-C. Lie, and Y. Zhang, “A new approach toautomated epileptic diagnosis using EEG and probabilistic neuralnetwork,” in Proceedings of 20th IEEE International Conferenceon Tools with Artificial Intelligence (ICTAI 2008), vol. 2, 2008.

    F. S. Bao, J.-M. Gao, J. Hu, D. Y. C. Lie, Y. Zhang, and K. J.Oommen, “Automated epilepsy diagnosis using interictal scalpEEG,” in Proceedings of 31st International Conference of IEEEEngineering in Medicine and Biology Society (EMBC 2009),2009.

  • Outline Introduction PyEEG Future work Questions?

    Bibliography II

    J. Dauwels, E. Eskandar, and S. Cash, “Localization of seizureonset area from intracranial non-seizure EEG by exploiting locallyenhanced sychrony,” in Proceedings of 31st InternationalConference of IEEE Engineering in Medicine and Biology Society(EMBC 2009), 2009.

    A. Petrosian, “Kolmogorov complexity of finite sequences andrecognition of different preictal EEG patterns,” in Proceedings of8th IEEE Symposium on Computer-Based Medical Systems,1995.

    T. Higuchi, “Approach to an irregular time series on the basis ofthe fractal theory,” Physica D, vol. 31, no. 2, pp. 277–283, 1988.

    B. Hjorth, “EEG analysis based on time domain properties,”Electroencephalography and Clinical Neurophysiology, vol. 29,pp. 306–310, 1970.

  • Outline Introduction PyEEG Future work Questions?

    Bibliography III

    S. Roberts, W. Penny, and I. Rezek, “Temporal and spatialcomplexity measures for electroencephalogram basedbrain-computer interfacing,” Medical and Biological Engineeringand Computing, vol. 37, no. 1, pp. 93–98, 1999.

    C. J. James and D. Lowe, “Extracting multisource brain activityfrom a single electromagnetic channel,” Artificial Intelligence inMedicine, vol. 28, no. 1, pp. 89–104, 2003.

    S. Pincus, I. Gladstone, and R. Ehrenkranz, “A regularity statisticfor medical data analysis,” Journal of Clinical Monitoring andComputing, vol. 7, no. 4, pp. 335–345, 1991.

    J. S. Richman and J. R. Moorman, “Physiological time-seriesanalysis using approximate entropy and sample entropy,”American Journal of Physiology - Heart and CirculatoryPhsiology, vol. 278, pp. H2039–H2049, 2000.

  • Outline Introduction PyEEG Future work Questions?

    Bibliography IV

    C.-K. Peng, S. Havlin, H. E. Stanley, and A. L. Goldberger,“Quantification of scaling exponents and crossover phenomenain nonstationary heartbeat time series,” Chaos, vol. 5, no. 1, pp.82–87, 1995.

    OutlineIntroductionFeature Extraction in Neurological Signal ProcessingEEG: The Name of The GameEEG Reading in Naked EyesA Case Study: Features may be betterWhy PyEEG?

    PyEEGMain FrameworkEEG Pre-processingFeaturesBasic Usage

    Future workQuestions?