|
|
@ -43,7 +43,7 @@ class Link_pred_Runner(): |
|
|
|
# index = DPP.list_of_samples[0] |
|
|
|
# index = DPP.list_of_samples[0] |
|
|
|
|
|
|
|
|
|
|
|
if self.data_name == 'cora': |
|
|
|
if self.data_name == 'cora': |
|
|
|
DPP.sample_exact_k_dpp(size=21) |
|
|
|
DPP.sample_exact_k_dpp(size=21) # e 21 ic 6 gpcr 3 |
|
|
|
index = DPP.list_of_samples[0] |
|
|
|
index = DPP.list_of_samples[0] |
|
|
|
pass |
|
|
|
pass |
|
|
|
elif self.data_name == 'citeseer': |
|
|
|
elif self.data_name == 'citeseer': |
|
|
@ -88,22 +88,26 @@ class Link_pred_Runner(): |
|
|
|
emb, avg_cost = update(ae_model, opt, sess, feas['adj_norm'], feas['adj_label'], feas['features'], placeholders, feas['adj'], kde, feas['features_dense']) |
|
|
|
emb, avg_cost = update(ae_model, opt, sess, feas['adj_norm'], feas['adj_label'], feas['features'], placeholders, feas['adj'], kde, feas['features_dense']) |
|
|
|
|
|
|
|
|
|
|
|
lm_train = linkpred_metrics(feas['val_edges'], feas['val_edges_false']) |
|
|
|
lm_train = linkpred_metrics(feas['val_edges'], feas['val_edges_false']) |
|
|
|
roc_curr, ap_curr, _ = lm_train.get_roc_score(emb, feas) |
|
|
|
roc_curr, ap_curr, _, aupr_score = lm_train.get_roc_score(emb, feas) |
|
|
|
val_roc_score.append(roc_curr) |
|
|
|
val_roc_score.append(roc_curr) |
|
|
|
print("Epoch:", '%04d' % (epoch + 1), |
|
|
|
print("Epoch:", '%04d' % (epoch + 1), |
|
|
|
"train_loss= {:.5f}, d_loss= {:.5f}, g_loss= {:.5f}, GD_loss= {:.5f}, GG_loss= {:.5f}".format(avg_cost[0], avg_cost[1], avg_cost[2], avg_cost[3], avg_cost[4]), "val_roc=", |
|
|
|
"train_loss= {:.5f}, d_loss= {:.5f}, g_loss= {:.5f}, GD_loss= {:.5f}, GG_loss= {:.5f}".format(avg_cost[0], avg_cost[1], avg_cost[2], avg_cost[3], avg_cost[4]), "val_roc=", |
|
|
|
"{:.5f}".format(val_roc_score[-1]), "val_ap=", "{:.5f}".format(ap_curr)) |
|
|
|
"{:.5f}".format(val_roc_score[-1]), "val_ap=", "{:.5f}".format(ap_curr), "val_aupr=", "{:.5f}".format(aupr_score)) |
|
|
|
|
|
|
|
|
|
|
|
if (epoch + 1) % 10 == 0: |
|
|
|
if (epoch + 1) % 10 == 0: |
|
|
|
lm_test = linkpred_metrics(feas['test_edges'], feas['test_edges_false']) |
|
|
|
lm_test = linkpred_metrics(feas['test_edges'], feas['test_edges_false']) |
|
|
|
roc_score, ap_score, _ = lm_test.get_roc_score(emb, feas) |
|
|
|
roc_score, ap_score, _, aupr_score = lm_test.get_roc_score(emb, feas) |
|
|
|
print('Test ROC score: ' + str(roc_score)) |
|
|
|
print('Test ROC score: ' + str(roc_score), 'Test AUPR score: ' + str(aupr_score), 'Test AP score: ' + str(ap_score)) |
|
|
|
print('Test AP score: ' + str(ap_score)) |
|
|
|
# print('Test AUPR score: ' + str(aupr_score)) |
|
|
|
record.append([roc_score, ap_score]) |
|
|
|
# print('Test AP score: ' + str(ap_score)) |
|
|
|
|
|
|
|
record.append([roc_score, aupr_score, ap_score]) |
|
|
|
record_emb.append(emb) |
|
|
|
record_emb.append(emb) |
|
|
|
rec = np.array(record) |
|
|
|
rec = np.array(record) |
|
|
|
index = rec[:, 0].tolist().index(max(rec[:, 0].tolist())) |
|
|
|
index = rec[:, 0].tolist().index(max(rec[:, 0].tolist())) |
|
|
|
|
|
|
|
index_pr = rec[:, 1].tolist().index(max(rec[:, 1].tolist())) |
|
|
|
emb = record_emb[index] |
|
|
|
emb = record_emb[index] |
|
|
|
ana = record[index] |
|
|
|
ana = record[index] |
|
|
|
|
|
|
|
ana_pr = record[index_pr] |
|
|
|
# scio.savemat('result/{}_link_64_64_new.mat'.format(self.data_name), {'embedded': emb,'labels': feas['true_labels']}) |
|
|
|
# scio.savemat('result/{}_link_64_64_new.mat'.format(self.data_name), {'embedded': emb,'labels': feas['true_labels']}) |
|
|
|
print('The peak val_roc=%f, ap = %f' % (ana[0], ana[1])) |
|
|
|
print('The peak [auc] test_roc=%f, aupr=%f, ap = %f' % (ana[0], ana[1], ana[2])) |
|
|
|
|
|
|
|
print('The peak [aupr] test_roc=%f, aupr=%f, ap = %f' % (ana_pr[0], ana_pr[1], ana_pr[2])) |
|
|
|