Exemple #1
0
    Notrain = (Noinst * 0.8).astype(int)
    Notest = (Noinst * 0.2).astype(int)

    Se_train = Se[:Notrain, :, :, :]
    R_train = R[:Notrain * i, :]
    R_test = R[Notrain * i:Noinst * i, :]
    Se_test = Se[Notrain:Noinst, :, :, :]

    mod1 = GCRFC()
    mod21 = GCRFC_fast()
    mod22 = GCRFC_fast()
    mod23 = GCRFC_fast()
    mod3 = GCRFC_fast()
    mod4 = GCRFC_fast()
    mod5 = GCRFC_fast()
    mod6 = GCRFCNB()

    mod1.alfa = np.array([3, 4])
    mod1.beta = np.array([4, 5])

    prob, Y, _ = mod1.predict(R, Se)

    Y_test = Y[Notrain:Noinst, :]
    Y_train = Y[:Notrain, :]

    start_time = time.time()
    mod1.fit(R_train, Se_train, Y_train, learn='TNC', maxiter=500)
    time_1[k] = time.time() - start_time

    start_time = time.time()
    mod21.fit(R_train,
Exemple #2
0
        x_train_com, y_train_com, x_test, Y_test)
    """ UNSTRUCTURED PREDICTORS """
    Skor_com_AUC[i, :], Skor_com_AUC2[i, :], Skor_com_ACC[i, :], Skor_com_ACC2[
        i, :], Skor_com_HL[
            i, :], R_train, R_test, R2, Noinst_train, Noinst_test, timeUN[
                i, :] = Nestrukturni_fun(x_train_un, y_train_un, x_train_st,
                                         Y_train, x_test, Y_test, No_class)
    """ STructured matrix """
    Se_train, Se_test = Struktura_fun(No_class, NoGraph, R2, y_train_com,
                                      Noinst_train, Noinst_test)
    """ Model GCRFC """
    Y_train = Y_train.values
    Y_test = Y_test.values

    start_time = time.time()
    mod1 = GCRFCNB()
    mod1.fit(R_train,
             Se_train,
             Y_train,
             learn='TNC',
             learnrate=6e-4,
             maxiter=iteracija)
    probNB, YNB = mod1.predict(R_test, Se_test)
    timeNB[i] = time.time() - start_time

    start_time = time.time()
    mod2 = GCRFC()
    mod2.fit(R_train,
             Se_train,
             Y_train,
             learn='TNC',
Exemple #3
0
i2 = np.arange(Noinst)

a = np.random.rand(Nopoint, 2)

Se = np.random.rand(Noinst, NoGraph, NodeNo, NodeNo)

Notrain = (Noinst * 0.8).astype(int)
Notest = (Noinst * 0.2).astype(int)

Se_train = Se[:Notrain, :, :, :]
R_train = R[:Notrain * NodeNo, :]
R_test = R[Notrain * NodeNo:Noinst * NodeNo, :]
Se_test = Se[Notrain:Noinst, :, :, :]

mod1 = GCRFC()
mod2 = GCRFCNB()
mod3 = GCRFC_fast()
k1 = 0

for i in rang:
    k2 = 0
    for j in rang:
        mod1.alfa = np.array([i])
        mod1.beta = np.array([j])

        prob, Y, _ = mod1.predict(R, Se)

        Y_test = Y[Notrain:Noinst, :]
        Y_train = Y[:Notrain, :]

        start_time = time.time()