Esempio n. 1
0
    zero_dim_btt_test = np.array(zero_dim_3)[test_index]

    one_dim_ltr_train = np.array(one_dim_0)[train_index]
    one_dim_rtl_train = np.array(one_dim_1)[train_index]
    one_dim_ttb_train = np.array(one_dim_2)[train_index]
    one_dim_btt_train = np.array(one_dim_3)[train_index]

    one_dim_ltr_test = np.array(one_dim_0)[test_index]
    one_dim_rtl_test = np.array(one_dim_1)[test_index]
    one_dim_ttb_test = np.array(one_dim_2)[test_index]
    one_dim_btt_test = np.array(one_dim_3)[test_index]

    ### Tent Features
    d = 10
    p = 1.2
    X_train_features_0_ltr_tent, X_test_features_0_ltr_tent = tent_features(zero_dim_ltr_train, zero_dim_ltr_test,d = d, padding = p)
    X_train_features_0_rtl_tent, X_test_features_0_rtl_tent = tent_features(zero_dim_rtl_train, zero_dim_rtl_test,d = d, padding = p)
    X_train_features_0_btt_tent, X_test_features_0_btt_tent = tent_features(zero_dim_btt_train, zero_dim_btt_test,d = d, padding = p)
    X_train_features_0_ttb_tent, X_test_features_0_ttb_tent = tent_features(zero_dim_ttb_train, zero_dim_ttb_test,d = d, padding = p)
    X_train_features_1_ltr_tent, X_test_features_1_ltr_tent = tent_features(one_dim_ltr_train, one_dim_ltr_test,d = d, padding = p)
    X_train_features_1_rtl_tent, X_test_features_1_rtl_tent = tent_features(one_dim_rtl_train, one_dim_rtl_test,d = d, padding = p)
    X_train_features_1_btt_tent, X_test_features_1_btt_tent = tent_features(one_dim_btt_train, one_dim_btt_test,d = d, padding = p)
    X_train_features_1_ttb_tent, X_test_features_1_ttb_tent = tent_features(one_dim_ttb_train, one_dim_ttb_test,d = d, padding = p)
    X_train_features = np.column_stack((X_train_features_1_ltr_tent,X_train_features_1_rtl_tent,X_train_features_1_ttb_tent,X_train_features_1_btt_tent,X_train_features_0_ltr_tent,X_train_features_0_rtl_tent,X_train_features_0_btt_tent,X_train_features_0_ttb_tent))
    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)
Esempio n. 2
0
        V1_sample,
        X0_sample,
        X1_sample,
        Y0_sample,
        Y1_sample,
        Z0_sample,
        Z1_sample,
        labels,
        test_size=.2,
        random_state=states[t],
        stratify=labels)

    ### Tent Features
    d = 10
    p = 1.5
    X_train_features_R0_tent, X_test_features_R0_tent = tent_features(
        R0_train_sample, R0_test_sample, d=d, padding=p)
    X_train_features_G0_tent, X_test_features_G0_tent = tent_features(
        G0_train_sample, G0_test_sample, d=d, padding=p)
    X_train_features_B0_tent, X_test_features_B0_tent = tent_features(
        B0_train_sample, B0_test_sample, d=d, padding=p)
    X_train_features_X0_tent, X_test_features_X0_tent = tent_features(
        X0_train_sample, X0_test_sample, d=d, padding=p)
    X_train_features_Y0_tent, X_test_features_Y0_tent = tent_features(
        Y0_train_sample, Y0_test_sample, d=d, padding=p)
    X_train_features_Z0_tent, X_test_features_Z0_tent = tent_features(
        Z0_train_sample, Z0_test_sample, d=d, padding=p)
    X_train_features_H0_tent, X_test_features_H0_tent = tent_features(
        H0_train_sample, H0_test_sample, d=d, padding=p)
    X_train_features_S0_tent, X_test_features_S0_tent = tent_features(
        S0_train_sample, S0_test_sample, d=d, padding=p)
    X_train_features_V0_tent, X_test_features_V0_tent = tent_features(
Esempio n. 3
0
    train_index = train_index
    test_index = np.load(test_index_name)
    test_index = test_index
    X_dgm0_train = np.array(X_dgm0, dtype=object)[train_index]
    X_dgm0_test = np.array(X_dgm0, dtype=object)[test_index]
    X_dgm1_train = np.array(X_dgm1, dtype=object)[train_index]
    X_dgm1_test = np.array(X_dgm1, dtype=object)[test_index]
    y_train = np.load(y_train_name)
    y_train = y_train
    y_test = np.load(y_test_name)
    y_test = y_test

    ### Tent Features
    d = 5
    p = 1
    X_train_features_1_tent, X_test_features_1_tent = tent_features(
        X_dgm1_train, X_dgm1_test, d, p)
    X_train_features_0_tent, X_test_features_0_tent = tent_features(
        X_dgm0_train, X_dgm0_test, d, p)
    X_train_features = np.column_stack(
        (X_train_features_0_tent, X_train_features_1_tent))
    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)