pbashivan / EEGLearn

A set of functions for supervised feature learning/classification of mental states from EEG based on "EEG images" idea.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ValueError: Unknown interpolation method 'cubic' for 3 dimensional data

maciejkos opened this issue · comments

Hi,

I am getting the following error and was wondering if you could help me fix it. I am using the sample data you provided.

Thanks!
-Maciej

Traceback (most recent call last):
  File "C:/Users/Christine/PycharmProjects/EEG_VM/main.py", line 15, in <module>
    images = eeglib.gen_images(locs, features, nGridPoints)
  File "C:\Users\Christine\Anaconda3\envs\EEG_VM\lib\site-packages\eeglearn\eeg_cnn_lib.py", line 96, in gen_images
    method='cubic', fill_value=np.nan)
  File "C:\Users\Christine\Anaconda3\envs\EEG_VM\lib\site-packages\scipy\interpolate\ndgriddata.py", line 225, in griddata
    "%d dimensional data" % (method, ndim))
ValueError: Unknown interpolation method 'cubic' for 3 dimensional data

main.py

import eeglearn
import eeglearn.eeg_cnn_lib as eeglib
import numpy as np

import scipy.io as sio # need this to load mat files

# load data
locs_raw = sio.loadmat("./sample_data/Neuroscan_locs_orig.mat")
locs = locs_raw['A']
features_raw = sio.loadmat("./sample_data/FeatureMat_timeWin.mat")
features = features_raw['features']
features = features[:, 0:-1] # remove the last column; otherwise, assert features.shape[1] % nElectrodes == 0  gives AssertionError
nGridPoints = 100

images = eeglib.gen_images(locs, features, nGridPoints)
eeglib.train(images, labels, train_test_fold, model_type)

EEGLearn_files.zip

Are you able to run the following?

import eeglearn
import eeglearn.eeg_cnn_lib as eeglib

images = eeglib.gen_images(locs, features, nGridPoints)
eeglib.train(images, labels, train_test_fold, model_type)

Thanks for the reply. Running this code produces the following error:

Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm 2017.3.3\helpers\pydev\pydev_run_in_console.py", line 53, in run_file
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "C:/Users/Christine/PycharmProjects/EEG_VM/mail-old.py", line 4, in <module>
    images = eeglib.gen_images(locs, features, nGridPoints)
NameError: name 'locs' is not defined

This is why I started modifying it (see my first post).

Right, it should fail as you said.
Try the following:

python eeg_cnn_lib.py

this should run and use the sample data to generate images and train the network.