EEG seizure analysis with machine learning and epochs

Hello, thank you for letting me post my question!

I have problems understanding the Output of the prediciton of the sklearn function.

Model training with this file:

Trying to load a few sample data (actually training data) to check model:

example output with predict

Anyone having an idea what exactly the 0 and 1 are telling me?

features array consists of 19 Channels with each analyse psds in 6 freqBands = 114 rows and 75 lines --epochs?!

Thanks so much in advance

Hello and welcome to the forum!

It’s really difficult to tell from just looking at the code. I would guess that maybe 1 means that a seizure was detected in the respective epoch?

Best wishes,
Richard

Hello Richard,

Thanks! Ok i think i got it now each value corresponds to a labeled epoch. So 0 means there was detected a seizure in this specific epoch.

This leads to another question. Is there any Chance to extract the time in second from the epoch array Index?

I want to determine when exactly the seizure has been detected.

Another idea of mine, since We habe fixed epoch lengths is just to add epoch lengs until the seizure has been detected.

Just like that:

loader = Loaded.predict(features)
print(loader)
print(len(loader))

#minDauerChecker = False

minDauerCounter = 0

for index, value in enumerate(loader):
    if value == 0: #Anfall erkannt, allerdings nur wenn mindestens 10 sekunden lang!! also in dem Fall 2s Fenster = 5*0Epochen
        #minDauerCounter += 1
        #if minDauerChecker == 2:
        SeizureEpoch = index + 1
        print(SeizureEpoch)
        seizure_present = True
        onset = SeizureEpoch*2 #wegen Epochenlänge fix
        # gibt den Beginn des Anfalls an (in Sekunden)
        break
    else: #Kein Anfall
        seizure_present = False
        #minDauerCounter = 0

An opinions on that?

Thanks in Advance!

This sounds like a reasonable approach to me. Be careful not to accidentally be off by one epoch :smiley: because in the code snippet you shared, I believe you are off, but I might be mistaken.

Thanks so much for your answer,

im investigating the counter mistke you are talking about, but cannot find one… Maybe you can clarify your thoughts?

Thanks so much!

In the code you shared above:

for index, value in enumerate(loader):
    if value == 0:
        SeizureEpoch = index + 1
        onset = SeizureEpoch*2

For a seizure that starts in the very first epoch already (index == 0), you’d assume its onset is at (index + 1) * 2 = 1 * 2 = 2 seconds – not at 0 seconds; which is clearly wrong.

Ciao,
Richard