Anomaly Detection for Seizure Prediction

14
Anomaly Detection for Seizure Prediction (anomaly detection in waveforms) Cynthia Alexander 22 nd September, 2016 10sec of human recordings sampled at 400Hz Anomaly Detection for Seizure Prediction Cynthia Alexander

Transcript of Anomaly Detection for Seizure Prediction

Presentacin de PowerPoint

Anomaly Detection for Seizure Prediction (anomaly detection in waveforms)

Cynthia Alexander 22nd September, 2016 10sec of human recordings sampled at 400HzAnomaly Detection for Seizure Prediction Cynthia Alexander

Hello, I am Cynthia and want to talk to you about a model for anomaly detection for seizure prediction

9s1

iEEG = intracranial + electricity + brain + picture (intracranial electro encephalogram)Electrode assemblies (implant)

Telemetry unit (implant)

Personal advisory device (hand-held)Cook M.J. et al Lancet Neurol. 2013

Anomaly Detection for Seizure Prediction Cynthia AlexanderImplanted systemSeizure prediction brief Hows and WhysMotivation:

Easily enhance day-to-day life of individuals suffering from epilepsy (~1% of adults over 18 years old*) by warning them about events that might happen so they can take precautions.

Or, even better, aid seizure prevention when combined with new treatments (i.e. deep-brain stimulation).

*Current numbers in the US taken from www.cdc.gov

Something really quick on how this works: brain waves are obtained by placing electordes directly on your brain.

The motivation to pursue this project is simple, about 1% of adults in the US suffer from epilepsy, and because of it they have seizures on which they might have no control on.

Current warning systems rely on self-awareness, so patients could definitely benefit from a prediction model

452

10m 10m 10m 10m 10m 10m 5m Seizure

1 hour (Pre-seizure)

Telemetry unit output data over time for 16 channelsAnomaly Detection for Seizure Prediction Cynthia AlexanderStandbyFor the model, each patients recordings over the 16 channels are split in 10 minutes windows

The goal is to accurately call pre-seizure windows as they happen, to then warn an individual facing a seizure

In my dataset there are recordings over months for a couple of patients, each of this with 16 electrode groups.

For the model recordings were split in two categories, standby and pre-seizure (encompassing 1 hour preceding a seizure), and further broke down to 10 minute windows.

The goal here is call pre-seizure windows as they happen to warn people to take some precautions. 1:003

Anomaly Detection for Seizure Prediction Cynthia AlexanderPipeline

Random Forests for Statistical Metrics and Signal Transformations2 layers Neural Network for spectrograms classification using Tensor Flow tools

Sample selectionFormatting and structureEDA, Data cleaningInput: Raw data from iEEGsOutput: Structured clean dataInput: Descriptive metrics, Signal transformations, Channel Correlations, Spectrograms EngineeringFeature Selection Summaries

Testing modelsParameter tuningValidation

Here I show overview on how this model was built:

I started from raw brain recordings, and there was a fair amount of data cleaning, and exploratory data analysis.Which eased feature selection and engineering.Then the output of this features was tested on different models, and once the models where selected, there was a bit or parameter tuning.All these allowed me to put together an app showing real data and model predictions.

1:40

4

Features Statistical metrics

Anomaly Detection for Seizure Prediction Cynthia Alexander

mean channel 11Normalized distributionstd channel 00Normalized distribution

absum channel 02Normalized distributionStandby Pre-seizure

About the features, the unit of prediction is a 10 min continuous signal varying in frequency and amplitude.

So to come up with features we need to aggregate the signal across electrodes or break it in smaller windows. First I used plain statistical metrics, and it was amusing to see how basic metrics already showed different distribution among classes.

2:105

Features Statistical metrics

Anomaly Detection for Seizure Prediction Cynthia Alexander

mean channel 11Normalized distributionstd channel 00Normalized distribution

absum channel 02Normalized distributionStandby Pre-seizure

Remarkable differences across patients i.e. Values for the median across channelsEach column one sample (10 min x 16 channels).

Median per channel and window

Patient A Patient B Patient C

Pre-seizure

And a really important take away is that when comparing patients side to side, their recordings are largely different.

So it became a clear objective to work on a personalized model, or in the normalization across patients

6

Image from mriquestions.com

Anomaly Detection for Seizure Prediction Cynthia AlexanderFeatures Correlation and Signal TransformationsAverage correlation of channels over all samples

Standby samples vs. all samples

Pre-seizure samplesvs. all samples

Wave decompositionFourier TransformEach readout can be decomposed into the frequencies that make it up: Gamma(32+ Hz)

Beta(16 31 Hz)

Alpha(8 15 Hz)

Theta(4 -7 Hz)

Delta(< 4 Hz)

Another step was to consider the correlation among electrode readouts since it is likely there is not one that points to a seizure but the combination of them

In this images each square represents the correlation among two electrodes coded by color, here the contrast of standby and pre-seizure samples to the bulk showed that pre-seizure samples have distinc correlations among electrodes. 7

Image from mriquestions.com

Anomaly Detection for Seizure Prediction Cynthia AlexanderFeatures Correlation and Signal TransformationsAverage correlation of channels over all samples

Standby samples vs. all samples

Pre-seizure samplesvs. all samples

Wave decompositionFourier TransformEach readout can be decomposed into the frequencies that make it up: Gamma(32+ Hz)

Beta(16 31 Hz)

Alpha(8 15 Hz)

Theta(4 -7 Hz)

Delta(< 4 Hz)

A necessary feature to add where signal transformations, specially the fourier transform which I performed over window slices on the samples.

This would decompose the readout for each electrode into the frequencies that make it up, which are further classified into delta waves (those present in sleep), alpha (during relaxing times), beta (on a range of acivities) and so on. Higher frequencies would be more comon in pre-seizure samples.8

Anomaly Detection for Seizure Prediction Cynthia Alexander

Features Spectrograms

StandbyPre-SeizureTime windowFrequencyAmplitud* Real samples, however most samples are not as easy to tell apart!

Another feature are spectograms, which describe the frequency and and amplitud over time windows, helping to differentiate the two classes

9

ResultsPersonalized model (train and predict on self over time): Trained on other patients data predict on (no self-prior knowledge):

Anomaly Detection for Seizure Prediction Cynthia Alexander

The model produced decent results for a personalized model, where it was trained and tested on the same person over time. Here Random Forest got top performance, with a precision/recall curve that shows that with a bit over 60% precision it gets over 80% recall, which is great since we care more about true positives than false positives here

However for the generalized model, when the model is trained and tested in different persons and even with normalized data, the predictive power drops. So this reflects the contrast about brain waves and possibly also faults in my model.10

Anomaly Detection for Seizure Prediction Cynthia AlexanderInteractive D3 App Red shaded areas depict windows in which the model called a pre-seizure sample

To better visualize this, I made an app, where the red shaded areas depict windows called as high risk by the personalized model.In this case this first call was a false positive. However down the line there is a true signal, for which a patient could have got about 20 minute warning before a seizure.11

In development and in order to help users:

Concentrate on personalized modelsFeed and predict on-App using real time dataIn the long run, aim for preemptive medicine where care is specially provided in high-risk windows (i.e. deep brain stimulation)

10sec of human recordings sampled at 400HzAnomaly Detection for Seizure Prediction Cynthia Alexander

Applications of this can be made for any other data that could be encoded in wave form and personalized records, but more importantly to directly benefit users I need to concentrate on personalized models, and evaliate real time data.

12

Questions? Reach out! Cynthia Alexander

[email protected] 4chromat cynthiaalexanderrascon 4chromat.github.io

Thank you!

Anomaly Detection for Seizure Prediction Cynthia Alexander10sec of human recordings sampled at 400Hz

Logos d3 tensor fllw13

Anomaly Detection for Seizure Prediction Cynthia AlexanderData cleaning Signal drop-outs and artifacts!

because in comparison to MEG/EEG studies, iEEG tends to be significantly less affected by artifacts,

Although EEG is designed to record cerebral activity it also records electrical activitiesarising from sites other than the brain, usually just considered artifacts that may or may not arise from the patients bodyf

Mechanical, external, artifacts, could be identified by a fixed form and a repetitive pattern. As well as signals that propagatte across electrodes that are not in proximity.Artifacts caused by muscles, would be of high amplitud and fast activity, and has a distribution that reflects the locations of muscles generating it. Typica muslces artifacts begin and end abruptly. Chewing, for example would make appear as a high amplitud wave across many electode readouts.

The large space of artifacts that could exist in a readout add a layer of complexity in the identification of true positive signals, that as in other wave frequency problems is alsways benefitial to identify the source.

Remove 50Hz noise14