This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import mne | |
from mne.decoding import GeneralizationAcrossTime as GAT | |
from sklearn.metrics import roc_auc_score | |
from sklearn.preprocessing import StandardScaler | |
from sklearn.svm import SVC | |
from sklearn.pipeline import make_pipeline | |
from sklearn.cross_validation import StratifiedKFold | |
from meeg_preprocessing.utils import setup_provenance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from sklearn.svm import LinearSVR | |
class SVR_angle(LinearSVR): | |
def __init__(self): | |
from sklearn.svm import LinearSVR | |
from sklearn.preprocessing import StandardScaler | |
from sklearn.pipeline import Pipeline |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import os.path as op | |
import matplotlib.pyplot as plt | |
import mne | |
from mne.decoding import GeneralizationAcrossTime | |
from mne.report import Report | |
from sklearn.pipeline import make_pipeline | |
from sklearn.preprocessing import StandardScaler | |
from sklearn.linear_model import LogisticRegression | |
# from sklearn.metrics import r2_score |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def scorer_auc(y_true, y_pred): | |
from sklearn.metrics import roc_auc_score | |
from sklearn.preprocessing import LabelBinarizer | |
"""Dedicated to 2class probabilistic outputs""" | |
le = LabelBinarizer() | |
y_true = le.fit_transform(y_true) | |
return roc_auc_score(y_true, y_pred) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pickle | |
import numpy as np | |
from base import subjects, paths | |
from mne.stats import permutation_cluster_1samp_test | |
# load scores | |
all_scores = list() | |
for subject in subjects: | |
print subject | |
with open(paths('scores', subject=subject), 'rb') as f: | |
scores = pickle.load(f) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
import itertools | |
import seaborn as sns | |
from base import paths | |
from sklearn.linear_model import LassoCV | |
import pickle | |
# load data | |
fname = paths('stats', subject='fsaverage', analysis='all') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
import mne | |
from mne.channels.layout import find_layout | |
from mne.datasets import sample | |
from mpl_toolkits.mplot3d import Axes3D | |
data_path = sample.data_path() | |
raw_fname = data_path + '/MEG/sample/sample_audvis_filt-0-40_raw.fif' | |
events_fname = data_path + '/MEG/sample/sample_audvis_filt-0-40_raw-eve.fif' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def simulate_data(): | |
"""Simulate data""" | |
from mne import create_info, EpochsArray | |
n_trial, n_chan, n_time = 100, 64, 200 | |
soas = np.array([17, 33, 50, 67, 83]) | |
event_soa = soas[np.random.randint(0, len(soas), n_trial)] | |
event_present = np.random.randint(0, 2, n_trial) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Author: Jean-Remi King | |
# | |
# Licence: BSD 3-clause | |
""" | |
This is a failed attempt to use a python implementation of Time Shift | |
PCA (https://github.com/pealco/python-meg-denoise) that aims as | |
denoising external MEG sources from the signals when we have reference | |
sensors available (e.g. in the KIT). | |
See http://audition.ens.fr/adc/NoiseTools/ for more info on TSPCA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Author: Jean-Remi King <jeanremi.king@gmail.com> | |
% | |
% Licence : To-be-determined | |
addpath('/media/DATA/Pro/Toolbox/NoiseTools/') % http://audition.ens.fr/adc/NoiseTools/ | |
demean = @(x) x - repmat(mean(x, 1), [size(x, 1), 1]); | |
%% Read data, prepare info | |
raw = load('raw.mat'); | |
data_empty = transpose(raw.empty(1:160, :)); % empty room: chan x time |