test_index, :] y_train_com, Y_test = output.iloc[train_index, :], output.iloc[ test_index, :] x_train_un, x_train_st, y_train_un, Y_train = train_test_split( x_train_com, y_train_com, test_size=testsize2, random_state=31) """ STRUCTURED PREDICTORS """ ACC_ST[i, :], HL_ST[i, :], time_ST[i, :] = Strukturni( 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
staze = np.load('staze.npy') staze = staze.astype(int) skijasi = pd.read_csv(str(staze[0]),index_col='date1') output = skijasi.label atribute = skijasi.drop(['label','vreme_pros'],axis=1) skf = KFold(n_splits = broj_fold) skf.get_n_splits(atribute, output) i = 0 for train_index,test_index in skf.split(atribute, output): timeST[i,:], Skor_R2_struct[i,:] = Strukturni_predict_fun(train_index, test_index, ModelSTNo) Skor_com_AUC[i,:], Skor_com_AUC2[i,:], R_train, R_test, R2, Noinst_train, Noinst_test, Y_train, Y_test = Nestrukturni_fun(train_index, test_index, No_class, testsize2) Se_train, Se_test = Struktura_fun(No_class,NoGraph,R2, train_index, test_index, Noinst_train, Noinst_test, testsize2) """ Model GCRFC """ 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', learnrate = 3e-4, learnratec = 0.5, maxiter = iteracija) np.save('mod2',mod2.x) probB, YB, VarB = mod2.predict(R_test,Se_test)