Stanford-STAGES / stanford-stages

Automated sleep staging scoring and narcolepsy identification
76 stars 26 forks source link

ValueError on new Data #20

Closed RaghavRao closed 4 years ago

RaghavRao commented 4 years ago

Hi,

Our team is trying to run the script on some new data.

When running it we get:

ValueError: could not broadcast input array from shape (57,5) into shape (1000,5)

Here are the script I'm using:

verify_chp_040.txt

And the full error output:

00000001_new.txt

informaton commented 4 years ago

What is the duration of the data you are using?

RaghavRao commented 4 years ago

I believe it's 638 seconds which is understandably short

informaton commented 4 years ago

Yes, this is going to be too short for the default settings in the code, which are set to process the input in 250 minute segments (~4 hours) at a time. You can shorten this by editing the inf_config.py file's init method of the ACConfig class, however the results will change some. The variable you want to change is atonce in the location here:

        if model_name[6:8] == 'ls':
            segsize = 60
            atonce = 1000 

The segsize variable refers to the epoch duration produced, it is the number of consecutive 0.25 s portions of the study grouped together in determining the likelihood of the different sleep stages within that time period (i.e. 15 s epochs here). The atonce variable refers to the number of segments (i.e. 15 s epochs) processed by the model at once (250 minutes in this case). If you reduce atonce to something smaller than your current duration (e.g. atonce=40), you will no longer get the value error.

The resulting hypnodensities are different though for different atonce values though. You will need to use data of longer duration and atonce=1000 if you want to have comparable performance of the results presented in the manuscript.

RaghavRao commented 4 years ago

The data window was far too short as pointed out.

informaton commented 4 years ago

Update

Changing the atonce value no longer changes the resulting hypnodensities in the master branch. Those using the manuscript branch should leave the atonce = 1000 in order to achieve the results presented with the example hypnodensity files.