An Energy Efficient Seizure Prediction Algorithm Zhongnn Fng Electricl Engineering Stnford University zhongnn@stnford.edu Yun Yun Sttistics Stnford University yun@stnford.edu Andrew Weitz Bioengineering Stnford University weitz@stnford.edu Astrct In this project, we sought to develop lerning lgorithm tht identifies EEG time series s pre-ictl (the time just efore seizure occurs) or inter-ictl (the time etween seizures) using undersmpled dt to reduce the energy consumption nd ndwidth usge. By trining the model with segmented second intervls nd predicting seizures with decision window, we chieved high seizure prediction ccurcy t downsmpling rte s high s. These techniques cn e rodly pplied to reduce energy demnds for vriety of werle medicl nd helth device pplictions. Index Terms Seizure prediction, Logistic regression, SVM, Energy efficiency. s EEG FFT Bndpower (BP)-sed F (.- Hz) df F (- Hz) df F (- Hz) df F (- Hz) df F (- Hz) df F (- Hz) df ch x = fetures s DWT EEG T( - Hz) T(- Hz) T(- Hz) T(.- Hz) T(.-. Hz) T(-. Hz) DWT-sed ch x = fetures / / / / /, / nσx, / nσx, / nσx, / nσx, / nσx, / nσx Fig.. We selected two feture sets for seizure prediction: ndpower-sed (left) nd DWT-sed (right). I. INTRODUCTION Epileptic seizures fflict over % of the world s popultion. If seizures could e predicted efore they occur, fst-cting therpies could e delivered to prevent the ttck nd restore norml qulity of life to ptients. Over the lst two decdes, severl studies hve explored the use of EEG signls to predict seizures using principles from mchine lerning [] []. It is thought tht such n lgorithm could e implemented in rel-time with wireless, implnted EEG sensor. However, there re two min constrints for such portle system. First, due to limited ttery life, energy consumption must e miniml. Second, due to limited ndwidth, the dt trnsmitted etween the sensor nd the centrl processing device (such s moile phone, tlet, personl computer, etc.) should e smll. To ddress these issues, we sought to develop roust lerning lgorithm tht identifies EEG time series s pre-ictl (the time just efore seizure occurs) or interictl (the time etween seizures) using downsmpled dt. This could ultimtely reduce oth power consumption nd ndwidth usge for werle seizure prediction devices (Fig. ). Werle Device Downsmpled EEG Energy Efficient Wireless chnnel Trnsfer Smller Bndwidth Feture Extrction Moile phone, Tlet, PC etc. Prediction Fig.. Undersmpling cn e used to reduce energy consumption nd dt trnsferring ndwidth on personl medicl nd helth devices. However, the effect of undersmpling on the performnce of mchine lerning lgorithms is still n open question. A. Dt description II. METHODS Dt ws provided y the Americn Epilepsy Society for its Seizure Prediction Chllenge on www.kggle.com. EEG recordings were collected in single epileptic cnine with pre-ictl (y=) nd inter-ictl (y=) exmple files. Ech file includes chnnels of continuous EEG recordings for min, smpled t. Hz. To increse the mount of dt ville for trining for seizure prediction, we split ech min file into s intervls to e individully clssified. This resulted in ( smple) ( chnnel) mtrix for ech of the m = ( files) ( sec) = dt points. B. Fetures ) Bndpower-sed feture: For the first feture set we investigted, we quntified the EEG spectrl power in six physiologicl frequency nds: delt (.- Hz), thet (- Hz), lph (- Hz), et (- Hz), low-gmm (- Hz), nd high-gmm (- Hz). This feture set hs previously een shown to perform well for seizure prediction using logistic regression nd SVM [], []. Spectrl power ws extrcted from ech s time series using the ndpower() function in Mtl. Becuse ech recording consisted of seprte chnnels, the totl numer of fetures per s intervl ws thus = (Fig. left). ) Wvelet sed feture: For the second feture set we investigted, we used the discrete wvelet trnsform (DWT) with levels of decomposition. The enefit of the DWT is tht it cn cpture signl chnges in oth the temporl nd frequency domin. This is importnt since the EEG signl is non-sttionry nd spectrum of the signl chnges over time. To compute the DWT, the time series ws decomposed into
Error Rte Error Rte Bndpower Feture SVM - Liner Logistic Regression SVM - Rdil...... Testing Trining..................... Numer of trining dtsets Numer of trining dtsets Numer of trining dtsets DWT Feture SVM - Liner Logistic Regression SVM - Rdil...... Testing Trining..................... Numer of trining dtsets Numer of trining dtsets Numer of trining dtsets Fig.. Lerning curves for ech comintion of lerning lgorithm nd feture set were nlyzed for potentil over- or under-fitting prolems. Ech dtset contins six hundred of second intervls. hierrchichl time series with different frequency nds: - Hz, - Hz, - Hz,.- Hz,.-. Hz, nd -. Hz (Fig. right). The following sttisticl fetures were clculted to represent the time-frequency distriution of the EEG signls, s originlly proposed in []: ) Men of the solute vlues of the wvelet coefficients in ech su-nd µ x. ) Averge power (i.e. sum of squres) of the wvelet coefficients in ech su-nd /nσx. ) Stndrd devition of the coefficients in ech su-nd σ x. ) Rtio of the solute men vlues of djcent su-nds µ x /µ x. With different su-nds this gives totl of + + + = fetures. Becuse ech recording consists of seprte chnnels, the totl numer of fetures per s intervl ws thus =. C. Trining methods ) Logistic Regression: We implemented logistic regression using the glmfit function in Mtl, with logit link function. ) Liner SVM: We implemented liner support vector mchine using the Liliner pckge in Mtl. Feture vectors were scled to the rnge -. to., s suggested y the Liliner uthors....... Trining Error Bndpower Fetures DWT Fetures.... LR SVM-liner SVM-rdil...... Testing Error Bndpower Fetures DWT Fetures.... LR SVM-liner SVM-rdil Fig.. %/% hold-out cross-vlidtion showed tht logistic regression nd the liner SVM using DWT-sed fetures result in the lowest error. Error rs give stndrd error cross repeted trils. Thet Vlues Bndpower - Hz - Hz - Hz - Hz - Hz.- Hz Thet Vlues Men Stndrd Devition Sum of Squres Rtio of Mens - Hz - Hz - Hz.- Hz.-. Hz DWT -. Hz - Hz - Hz - Hz.- Hz.-. Hz -. Hz - Hz - Hz - Hz.- Hz.-. Hz -. Hz (-)/(-)Hz (-)/(-) Hz (-)/(.-) Hz (.-)/(.-.) Hz (.-.)/(-.) Hz Fig.. Logistic θ vlues were compred for oth ndpower-sed nd DWT-sed fetures to identify those most importnt feture for seizure prediction. For ndpower, the most highly weighted fetures corresponded to low frequency nds. For DWT-sed fetures, the the most highly weighted sttistic ws the rtio etween the mens of djcent frequency nds. Lower frequencies were lso more highly weighted for of the sttistics (men, sum of squres, nd rtio of mens). Note tht θ vlues represent the verge over chnnels. ) Rdil (Gussin) SVM: We implemented the SVM rdil kernel using the LiSVM pckge in Mtl. Feture vectors were lso scled to the rnge -. to., s with the liner kernel. D. Lerning curve nd cross-vlidtion To confirm tht our lerning lgorithm could ccurtely clssify pre-ictl nd inter-ictl sttes using the defined fetures without under- or over-fitting, we first generted lerning curves s function of dtset size (i.e. the numer of min EEG files). The testing set ws kept t constnt size of EEG files, with positive exmples nd negtive exmples. The trining set ws evluted for sizes rnging from to EEG files, lwys with n equl numer of positive nd negtive exmples. The generliztion error of ech lerning lgorithm ws evluted using repeted trils of %/% hold-out crossvlidtion. We split the originl EEG files into rndomly ssigned groups of trining nd testing dtsets. E. Seizure clssifiction As noted ove, the originl dt were cquired s single files of min EEG recordings (lelled s pre-ictl or interictl), which we then divided into six hundred s intervls. Although our lerning lgorithms treted the fetures from ech of these s intervls s single dt point, we ultimtely sought wy to predict seizures t lrger temporl scle, such s every s or min. To do so, we implemented decision window, in which the recording ws clssified s pre-ictl if the frction of s intervls clssified s preictl exceeded certin threshold. The resulting flse-positive nd flse-negtive rtes with different thresholds were then used to generte ROC curves for performnce evlution. To determine how much dt our lgorithm needed to generte correct prediction, we lso vried the decision window size (i.e. how mny s intervls were used to mke decision on pre-ictl or inter-ictl). In prctice, smller window mens
Inter-ictl EEG (y = ). Voltge (μv) s clssifiction Decision Window Time (min) Are Under ROC.... Logistic BP SVM-Liner BP SVM-Rdil BP Logistic DWT SVM-Liner DWT SVM-Rdil DWT.. Decision Window s clssifiction Time (min)..... Pre-ictl EEG (y = )... Voltge (μv).......... Fig.. Representtive clssifiction of s intervls for inter-ictl () nd pre-ictl () EEG recordings re shown. A decision window of vrying size is then pplied for seizure prediction nd genertion of ROC curves... tht prediction cn e mde t finer temporl scle (Fig. ). F. Downsmpling pttern..... Two different ptterns were tested for reducing energy consumption nd ndwidth usge: periodic nd rndom downsmpling. Periodic downsmpling is equivlent to reduce the smpling rte of the originl signl. Becuse of the recent development of compressed sensing theory, rndom downsmpling hs lso ecome populr for signl recovery fter downsmpling []. Thus the rndom downsmpling pttern ws lso tested in this project........... Fig.. () The flse positive rte versus true positive rte of different lgorithm nd feture comintions ws compred with min decision window. Similr to cross-vlidtion, logistic regression nd the liner SVM using DWT-sed fetures outperformed ll other models. () As the window size increses, the liner SVM using the DWT-sed feture set gives etter seizure prediction performnce. III. R ESULTS A. Identifiction of the optiml seizure prediction lgorithm ) Selection of the optiml feture nd lerning lgorithm: We next sought to identify the optiml feture nd lerning lgorithm with %/% hold-out cross-vlidtion. As shown in Fig., trining with logistic regression or liner SVM using the DWT-sed feture gve the est performnce, chieving less thn. trining error nd less thn. testing error. The rdil SVM exhiited poor performnce, resulting in lmost. trining nd testing error using the ndpowersed feture. Thus, we conclude tht the logistic regression nd rdil SVM lgorithms using the DWT-sed feture re optiml for seizure prediction. ) Investigting the most importnt fetures: We next nlyzed the θ vlues of the logistic regression model to determine which elements re the most importnt. As shown in Fig., we found the highest ndpower θ vlue is t the frequency nd.-hz, which indictes tht the most importnt differences etween the pre-ictl nd inter-ictl sttes re stored in this nd. Similrly, we found the lower ) Vlidtion of fetures nd lerning lgorithms: We first sought to confirm tht the chosen lerning lgorithms could clssify EEG signls s pre-ictl or inter-ictl ove % chnce level nd dignose if lerning ws suject to under- or over-fitting. Fig. provides the lerning curves for ech lerning lgorithm using the ndpower- nd DWTsed fetures. Logistic regression nd the liner SVM gve comprle performnce for either feture set, while the rdil SVM filed to lern using the ndpower-sed fetures nd resulted in reltively higher testing error rte using DWTsed fetures. With the exception of the rdil SVM using ndpower-sed fetures, the generl shpes of the lerning curves were consistent with expecttions. As the trining set size incresed, the trining error went up, while the testing error went down. Thus,the logistic regression nd liner SVM models successfully used the extrcted fetures to predict preictl versus inter-ictl sttes.
sec CV Error...... - Rndom Downsmpling Periodic Downsmpling Fully smpled, Hz x, Hz Downsmpling Rtio x, Hz x, Hz x, Hz Fig.. s intervl cross-vlidtion error of liner SVM using the DWT-sed fetures s function of downsmpling rte. Two different downsmpling ptterns were investigted (periodic nd rndom). For oth downsmpling ptterns, the optiml lgorithm chieved less thn. error when the downsmpling rtio ws less thn. When the downsmpling rtio pproches (i.e. only one smple is cquired per chnnel ech second), the error rte increses to.. frequency coefficients re lso weighted higher in the DWTsed fetures. Importntly, most significnt fetures tht were used for recognition re the rtios etween solute signl mens (µ x /µ x ) for the DWT-sed fetures. ) Seizure clssifiction using decision window: The results reported ove refer to the clssifiction of individul s intervls. Becuse we were ultimtely interested in clssifying the EEG signl s pre-ictl or inter-ictl t different time scles, we pplied simple thresholding on intermedite s decisions within decision window (Fig. ). By vrying the seizure prediction threshold for min decision window, n ROC curve tht quntifies the true positive nd flse positive rte t different threshold is otined (Fig. ). It cn e concluded tht the DWT-feture with logistic regression or liner SVM gve superior performnce (more thn % re under ROC curve). The ndpower-sed feture hd worse performnce thn DWT for ech lerning lgorithm. The rdil SVM still performed worse thn oth logistic regression nd the liner SVM for either feture. The size of the decision window ws lso investigted using one of the est lerning lgorithms, i.e. DWT-feture with liner SVM. As shown in Fig., we found tht the seizure prediction performnce increses with window size. Surprisingly, resonle performnce (% re under ROC curve) could still e otined with only s window. B. Roustness of the optiml seizure prediction lgorithm under downsmpling ) Cross vlidtion error vs downsmpling rtio: We investigted the roustness to downsmpling of one of the optiml lgorithms (liner SVM with DWT-sed fetures). As shown in Fig., the cross vlidtion error using the s intervls slowly incresed from. to. s the downsmpling rtio incresed to. When the downsmpling rtio reched x, the lgorithm filed to correctly clssify the s intervls nd the error drmticlly incresed to out.. Another finding from this test is tht the periodic downsmpling performs slightly etter thn the rndom downsmpling, which could.... Periodic Downsmpling Downsmple Fctor x ( Hz) Downsmple Fctor x ( Hz)............ Rndom Downsmpling Downsmple Fctor x ( Hz) Downsmple Fctor x ( Hz)........ Fig.. Although downsmpling incresed the error rte for sec clssifiction, the seizure prediction performnce could e improved y using lrger decision window. For exmple, when the s intervl ws downsmpled y times, our system could still chieve greter thn. true positive rte nd less thn. flse positive rte using decision window of t lest s. ecuse the lising pttern is more coherent using the periodic undersmpling nd thus the lerning lgorithm could pick up the lised fetures more esily. ) Improving performnce with lrger decision window sizes: Although we showed tht the s cross vlidtion error incresed s the downsmpling rtio incresed, the seizure prediction performnce could e preserved y incresing the decision window size. As shown in Fig., we investigted the ROC curve with x nd x downsmpling using seven different window sizes. The ROC curves re pproximtely equl etween the periodic nd rndom downsmpling methods. With window size lrger thn s, we found tht the optiml lgorithm could still chieve higher thn. true positive rte nd less thn. flse positive rte when the downsmpling rtio ws s high s. At times downsmpling, we found tht decision windows lrger thn s could still chieve similrly high prediction performnce (i.e. lrger thn. true positive nd less thn. flse positive rte). IV. CONCLUSIONS, DISCUSSIONS In this project, we developed n energy efficient lgorithm for seizure prediction. We investigted two different types of fetures (powernd-sed nd DWT-sed), nd three different lerning lgorithms (logistic regression, liner SVM nd rdil SVM). After cross vlidtion, we found tht logistic regression nd liner SVM using the DWT-sed fetures outperforms ll other lgorithms. We lso found tht low frequency signls contin the most informtion on the differences etween pre-ictl nd inter-ictl rin sttes. To improve the
roustness of our clssifiction, we designed decision window method for seizure prediction. With window sizes s lrge s s, the lgorithm could chieve greter thn. true positive rte nd less thn. flse positive rte. Surprisingly, performnce ws still fr etter thn chnce with decision windows s smll s s. We next investigted the roustness of one of the optiml lgorithms (liner SVM with DWT-sed fetures) to downsmpling. We found the cross vlidtion error incresed with lrger downsmpling rtios, lthough the error rte ws still less thn. for downsmpling rtios less thn. We lso showed tht lrge decision windows could e used to improve the prediction ccurcy using downsmpled dt. For exmple, with window size lrger thn s, we chieved greter thn. true positive rte nd less thn. flse positive rte using dt smpled t only Hz. One interesting finding from this project is tht the lerning lgorithm still performs well when the EEG signl is downsmpled with lising rtifcts. This could e ecuse most of the importnt fetures were stored in the low frequency domin. Another possile reson is tht even when the signl is lised, the lerning lgorithm could still use fetures t specific lised loctions for clssifiction. With the proposed roust seizure prediction lgorithm, energy consumption nd ndwidth usge on werle EEG devices cn e lrgely reduced. This method cn lso e implemented in other personl werle devices, such s hert rte monitor, for higher energy efficiency nd longer ttery life. ACKNOWLEDGMENT The uthors would like to thnk Professor Andrew Ng for his inspirtionl lectures nd shring his enthusism for the mchine lerning. We would lso like to thnk ll TAs for their thoughtful suggestions for this project. REFERENCES [] F. Mormnn, R. G. Andrzejk, C. E. Elger, nd K. Lehnertz, Seizure prediction: the long nd winding rod, Brin, vol., no., pp.,. [] Y. Prk, L. Luo, K. K. Prhi, nd T. Netoff, Seizure prediction with spectrl power of eeg using cost-sensitive support vector mchines, Epilepsi, vol., no., pp.,. [] J. J. Howert, E. E. Ptterson, S. M. Sted, B. Brinkmnn, V. Vsoli, D. Crepeu, C. H. Vite, B. Sturges, V. Ruedeusch, J. Mvoori et l., Forecsting seizures in dogs with nturlly occurring epilepsy, PloS one, vol., no., p. e,. [] A. Susi, Eeg signl clssifiction using wvelet feture extrction nd mixture of expert model, Expert Systems with Applictions, vol., no., pp.,. [] Z. Zhng, T.-P. Jung, S. Mkeig, nd B. D. Ro, Compressed sensing of eeg for wireless telemonitoring with low energy consumption nd inexpensive hrdwre, Biomedicl Engineering, IEEE Trnsctions on, vol., no., pp.,. V. FUTURE WORK Since the nlysis ws conducted on single niml, more experiments should e conducted to justify the method. The energy svings gined from downsmpling should lso e investigted so tht n optiml decision window size cn e identified for emedded pplictions.