<s> """<STR_LIT>""" <EOL> import numpy as np <EOL> import matplotlib . pyplot as plt <EOL> from sklearn . metrics import roc_auc_score <EOL> from sklearn . cross_validation import StratifiedKFold <EOL> import mne <EOL> from mne . datasets import sample <EOL> from mne . decoding import TimeDecoding , GeneralizationAcrossTime <EOL> data_path = sample . data_path ( ) <EOL> plt . close ( '<STR_LIT:all>' ) <EOL> raw_fname = data_path + '<STR_LIT>' <EOL> event_fname = data_path + '<STR_LIT>' <EOL> tmin , tmax = - <NUM_LIT> , <NUM_LIT:0.5> <EOL> event_id = dict ( aud_l = <NUM_LIT:1> , vis_l = <NUM_LIT:3> ) <EOL> raw = mne . io . read_raw_fif ( raw_fname , preload = True ) <EOL> raw . filter ( <NUM_LIT:2> , None , method = '<STR_LIT>' ) <EOL> events = mne . read_events ( event_fname ) <EOL> raw . info [ '<STR_LIT>' ] += [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> picks = mne . pick_types ( raw . info , meg = '<STR_LIT>' , eeg = False , stim = True , eog = True , <EOL> exclude = '<STR_LIT>' ) <EOL> epochs = mne . Epochs ( raw , events , event_id , tmin , tmax , proj = True , <EOL> picks = picks , baseline = None , preload = True , <EOL> reject = dict ( grad = <NUM_LIT> , eog = <NUM_LIT> ) ) <EOL> epochs_list = [ epochs [ k ] for k in event_id ] <EOL> mne . epochs . equalize_epoch_counts ( epochs_list ) <EOL> data_picks = mne . pick_types ( epochs . info , meg = True , exclude = '<STR_LIT>' ) <EOL> td = TimeDecoding ( predict_mode = '<STR_LIT>' , n_jobs = <NUM_LIT:1> ) <EOL> td . fit ( epochs ) <EOL> td . score ( epochs ) <EOL> td . plot ( title = '<STR_LIT>' ) <EOL> y = np . zeros ( len ( epochs . events ) , dtype = int ) <EOL> y [ epochs . events [ : , <NUM_LIT:2> ] == <NUM_LIT:3> ] = <NUM_LIT:1> <EOL> cv = StratifiedKFold ( y = y ) <EOL> gat = GeneralizationAcrossTime ( predict_mode = '<STR_LIT>' , n_jobs = <NUM_LIT:1> , <EOL> cv = cv , scorer = roc_auc_score ) <EOL> gat . fit ( epochs , y = y ) <EOL> gat . score ( epochs ) <EOL> gat . plot ( ) <EOL> gat . plot_diagonal ( ) </s>
