Exemplo n.º 1
0
    X_test_features = np.column_stack((X_test_features_1_ltr_tent,X_test_features_1_rtl_tent,X_test_features_1_ttb_tent,X_test_features_1_btt_tent,X_test_features_0_ltr_tent,X_test_features_0_rtl_tent,X_test_features_0_btt_tent,X_test_features_0_ttb_tent))

    ### Ridge Model
    ridge_model = RidgeClassifier().fit(X_train_features, y_train)
    tent_train_accuracy_ridge[t] = ridge_model.score(X_train_features, y_train)
    tent_test_accuracy_ridge[t] = ridge_model.score(X_test_features, y_test)

    ### SVM Model
    c = 5
    svm_model = SVC(kernel='rbf', C = c).fit(X_train_features, y_train)
    tent_train_accuracy_svm[t] = svm_model.score(X_train_features, y_train)
    tent_test_accuracy_svm[t] = svm_model.score(X_test_features, y_test)

    ### Adaptive Features
    d = 35
    X_train_features_0_ltr_gmm, X_test_features_0_ltr_gmm = adaptive_features(zero_dim_ltr_train, zero_dim_ltr_test, model="gmm", y_train=y_train, d = d)
    X_train_features_0_rtl_gmm, X_test_features_0_rtl_gmm = adaptive_features(zero_dim_rtl_train, zero_dim_rtl_test, model="gmm", y_train=y_train, d = d)
    X_train_features_0_ttb_gmm, X_test_features_0_ttb_gmm = adaptive_features(zero_dim_ttb_train, zero_dim_ttb_test, model="gmm", y_train=y_train, d = d)
    X_train_features_0_btt_gmm, X_test_features_0_btt_gmm = adaptive_features(zero_dim_btt_train, zero_dim_btt_test, model="gmm", y_train=y_train, d = d)

    X_train_features_1_ltr_gmm, X_test_features_1_ltr_gmm = adaptive_features(one_dim_ltr_train, one_dim_ltr_test, model="gmm", y_train=y_train, d = d)
    X_train_features_1_rtl_gmm, X_test_features_1_rtl_gmm = adaptive_features(one_dim_rtl_train, one_dim_rtl_test, model="gmm", y_train=y_train, d = d)
    X_train_features_1_ttb_gmm, X_test_features_1_ttb_gmm = adaptive_features(one_dim_ttb_train, one_dim_ttb_test, model="gmm", y_train=y_train, d = d)
    X_train_features_1_btt_gmm, X_test_features_1_btt_gmm = adaptive_features(one_dim_btt_train, one_dim_btt_test, model="gmm", y_train=y_train, d = d)
    X_train_features = np.column_stack((X_train_features_1_ltr_gmm,X_train_features_1_rtl_gmm,X_train_features_1_ttb_gmm,X_train_features_1_btt_gmm,X_train_features_0_ltr_gmm,X_train_features_0_rtl_gmm,X_train_features_0_btt_gmm,X_train_features_0_ttb_gmm))
    X_test_features = np.column_stack((X_test_features_1_ltr_gmm,X_test_features_1_rtl_gmm,X_test_features_1_ttb_gmm,X_test_features_1_btt_gmm,X_test_features_0_ltr_gmm,X_test_features_0_rtl_gmm,X_test_features_0_btt_gmm,X_test_features_0_ttb_gmm))

    ridge_model = RidgeClassifier().fit(X_train_features, y_train)
    gmm_train_accuracy_ridge[t] = ridge_model.score(X_train_features, y_train)
    gmm_test_accuracy_ridge[t] = ridge_model.score(X_test_features, y_test)
Exemplo n.º 2
0
         X_test_features_Z1_tent, X_test_features_H1_tent,
         X_test_features_S1_tent, X_test_features_V1_tent))

    ### Ridge Model
    ridge_model = RidgeClassifier().fit(X_train_features, y_train)
    tent_train_accuracy_ridge[k] = ridge_model.score(X_train_features, y_train)
    tent_test_accuracy_ridge[k] = ridge_model.score(X_test_features, y_test)

    ### SVM Model
    c = 5
    svm_model = SVC(kernel='rbf', C=c).fit(X_train_features, y_train)
    tent_train_accuracy_svm[k] = svm_model.score(X_train_features, y_train)
    tent_test_accuracy_svm[k] = svm_model.score(X_test_features, y_test)

    ### CDER Adaptive
    X_train_features_R0_cder, X_test_features_R0_cder = adaptive_features(
        R0_train_sample, R0_test_sample, "cder", y_train)
    X_train_features_G0_cder, X_test_features_G0_cder = adaptive_features(
        G0_train_sample, G0_test_sample, "cder", y_train)
    X_train_features_B0_cder, X_test_features_B0_cder = adaptive_features(
        B0_train_sample, B0_test_sample, "cder", y_train)
    X_train_features_X0_cder, X_test_features_X0_cder = adaptive_features(
        X0_train_sample, X0_test_sample, "cder", y_train)
    X_train_features_Y0_cder, X_test_features_Y0_cder = adaptive_features(
        Y0_train_sample, Y0_test_sample, "cder", y_train)
    X_train_features_Z0_cder, X_test_features_Z0_cder = adaptive_features(
        Z0_train_sample, Z0_test_sample, "cder", y_train)
    X_train_features_H0_cder, X_test_features_H0_cder = adaptive_features(
        H0_train_sample, H0_test_sample, "cder", y_train)
    X_train_features_S0_cder, X_test_features_S0_cder = adaptive_features(
        S0_train_sample, S0_test_sample, "cder", y_train)
    X_train_features_V0_cder, X_test_features_V0_cder = adaptive_features(
Exemplo n.º 3
0
    X_test_features = np.column_stack(
        (X_test_features_0_tent, X_test_features_1_tent))

    ### Ridge Model
    ridge_model = RidgeClassifier().fit(X_train_features, y_train)
    tent_train_accuracy_ridge[k] = ridge_model.score(X_train_features, y_train)
    tent_test_accuracy_ridge[k] = ridge_model.score(X_test_features, y_test)

    ### SVM Model
    c = 1
    svm_model = SVC(kernel='rbf', C=c).fit(X_train_features, y_train)
    tent_train_accuracy_svm[k] = svm_model.score(X_train_features, y_train)
    tent_test_accuracy_svm[k] = svm_model.score(X_test_features, y_test)

    ### Adaptive Features
    X_train_features_1_gmm, X_test_features_1_gmm = adaptive_features(
        X_dgm1_train, X_dgm1_test, "cder", y_train)
    X_train_features_0_gmm, X_test_features_0_gmm = adaptive_features(
        X_dgm0_train, X_dgm0_test, "cder", y_train)
    X_train_features = np.column_stack(
        (X_train_features_0_gmm, X_train_features_1_gmm))
    X_test_features = np.column_stack(
        (X_test_features_0_gmm, X_test_features_1_gmm))

    ridge_model = RidgeClassifier().fit(X_train_features, y_train)
    gmm_train_accuracy_ridge[k] = ridge_model.score(X_train_features, y_train)
    gmm_test_accuracy_ridge[k] = ridge_model.score(X_test_features, y_test)

    c = 1
    svm_model = SVC(kernel='rbf', C=c).fit(X_train_features, y_train)
    gmm_train_accuracy_svm[k] = svm_model.score(X_train_features, y_train)
    gmm_test_accuracy_svm[k] = svm_model.score(X_test_features, y_test)