コード例 #1
0
import matplotlib.pyplot as plt

from mne.decoding import GeneralizationAcrossTime
from mne.epochs import concatenate_epochs

from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LogisticRegression

from jr.utils import OnlineReport
from jr.gat import force_predict, scorer_auc

from base import eeglab2mne


report = OnlineReport()

##############################################################################
# Load data
data_path = '/media/jrking/harddrive/Simon'

all_scores = dict(HL=list(), EU=list(), PR=list())
for subject in range(1, 33):
    file_name = op.join(data_path, 's%i.mat' % subject)

    #######################################################################
    # Preprocessing to speed it up
    epochs = eeglab2mne(file_name)
    np.random.RandomState(1)
    order = np.arange(len(epochs))
    np.random.shuffle(order)
コード例 #2
0
"""
Plot decoding results
"""
import numpy as np
import itertools
import os.path as op
import pickle
import matplotlib.pyplot as plt
from jr.utils import OnlineReport
from jr.plot import pretty_gat, pretty_decod, pretty_slices

data_path = '/media/jrking/harddrive/Simon'
report = OnlineReport()
# gather subjects scores
contrasts = ['HL', 'EU', 'PR']
all_scores = dict(HL=list(), EU=list(), PR=list(),
                  EU_H=list(), PR_H=list(),
                  EU_L=list(), PR_L=list())
for subject, contrast in itertools.product(range(1, 33), contrasts):
    fname = op.join(data_path, 's%i_%s_scores.npy' % (subject, contrast))
    scores = np.load(fname)
    all_scores[contrast].append(scores)

# gather subscores
for subject, HL, contrast in itertools.product(
        range(1, 33), [0, 1], ['EU', 'PR']):
    subcontrast = '%s_%s' % (contrast, 'HL'[HL])
    fname = op.join(data_path, 's%i_%s_scores.npy' % (subject, subcontrast))
    scores = np.load(fname)
    all_scores[subcontrast].append(scores)