angular_clf = AngularRegression(clf=clf)
bag_clf = BaggingRegressor(angular_clf, warm_start=True)
clf_angle3 = make_pipeline(StandardScaler(), bag_clf)
gat_angle3 = GeneralizationAcrossTime(clf=clf_angle3, scorer=scorer_angle,
                                      n_jobs=-1)

clf = RidgeCV()
angular_clf = AngularClassifier(clf=LogisticRegression())
bag_clf = BaggingRegressor(angular_clf, warm_start=True)
clf_angle4 = make_pipeline(StandardScaler(), bag_clf)
gat_angle4 = GeneralizationAcrossTime(clf=clf_angle3, scorer=scorer_angle,
                                      n_jobs=-1)

for subject in subjects:

    report = OnlineReport()
    # target ------------------------------------------------------------------
    epochs, events = load(subject, 'Target')

    # Decode angles -----------------------------------------------------------
    gat = gat_angle
    angles = np.array(events['left_angle'].as_matrix(), float)
    gat.fit(epochs, y=angles)
    gat.score(epochs, y=angles)
    fig, ax = plt.subplots(1)
    gat.plot(ax=ax, show=True)
    report.add_figs_to_section(fig, 'left_SVR', subject + 'Target')
    print('left_SVR', 'Target')

    gat = gat_angle
    angles = np.array(events['right_angle'].as_matrix(), float)
Beispiel #2
0
elif decodAngle_parameter == 2:
    angle_bin = np.linspace(0+np.pi/6, np.pi*2+np.pi/6, 6)
    clf_angle = make_pipeline(StandardScaler(), AngularClassifier(clf=LogisticRegression(),
                              bins=angle_bin))
    gat_angle = GeneralizationAcrossTime(clf=clf_angle, scorer=scorer_angle,
                                         n_jobs=-1)

clf_regress = make_pipeline(StandardScaler(), LinearSVR())
gat_regress = GeneralizationAcrossTime(clf=clf_regress, scorer=scorer_spearman,
                                       n_jobs=-1)

gat_class = GeneralizationAcrossTime(n_jobs=-1)

for subject in subjects:

    report = OnlineReport()
    # target ------------------------------------------------------------------
    epochs, events = load(subject, 'Target')
    epochs.resample(64)
    # Decode angles -----------------------------------------------------------
    gat = gat_angle
    angles = np.array(events['left_angle'].as_matrix(), float)
    gat.fit(epochs, y=angles)
    score = gat.score(epochs, y=angles)
    fig, ax = plt.subplots(1)
    gat.plot(ax=ax, show=False)
    report.add_figs_to_section(fig, 'left_angle', subject + 'Target')
    all_left_angle = list()
    all_left_angle.append(score)
    print('left_angle', 'Target')