-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGCOMB_RESULTS_PARSE.py
60 lines (46 loc) · 3.28 KB
/
GCOMB_RESULTS_PARSE.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#
dataset_list=["large_graph_youtube","large_gowallah"]#["large_graph_youtube"]#large_gowallah"]#,
for dataset in dataset_list:
print(dataset)
for sampling_neighborhood in [ 0.3, 0.5, 0.7, 0.9,1.0]:
out_gcomb_quality=open('GCOMB_BUDGET_RESULTS/{}_nbs{}'.format(dataset,sampling_neighborhood) + 'gcomb_quality_budgets.txt', 'w')
out_gcomb_total_time=open('GCOMB_BUDGET_RESULTS/{}_nbs{}'.format(dataset,sampling_neighborhood) + '_gcomb_time_budgets.txt', 'w')
out_greedy_quality=open('GCOMB_BUDGET_RESULTS/{}'.format(dataset) + 'greedy_quality_budgets.txt', 'w')
out_greedy_time=open('GCOMB_BUDGET_RESULTS/{}'.format(dataset) + 'greedy_time_budgets.txt', 'w')
out_supgs_quality=open('GCOMB_BUDGET_RESULTS/{}'.format(dataset) + 'supgs_quality_budgets.txt', 'w')
# out_supgs_time=open('GCOMB_BUDGET_RESULTS/{}_nbs{}'.format(dataset,sampling_neighborhood) + 'supgs_time_budgets.txt', 'w')
for budget in [10, 20, 50, 80 ,100, 120,150, 180, 200]:
print(" SAMPLING ", sampling_neighborhood)
print("BUDGET ", budget)
graph_path="./GraphSAGE-master/real_data/{}/test/large_graph".format(dataset)
rl_data = open(graph_path+'-reward_RL{}_nbs{}'.format(budget, sampling_neighborhood),'r').readlines()
reward_gcomb= rl_data[0].replace('\n','')
rl_time_taken = float(rl_data[1].replace('\n','').split(':')[1])
greedy_reward = open(graph_path+'-G.json.greedyReward{}_{}'.format(budget, budget),'r').read().replace('\n','')
# print(greedy_data)
# print(greedy_reward)
greedy_time = open(graph_path+'-G.json.greedy_Sol{}_{}_time'.format(budget, budget),'r').read().replace('\n','')
print("GREEDY ",greedy_reward, greedy_time)
sup_gs_reward= open(graph_path+'.sup_GS_reward{}'.format(budget),'r').readlines()[0].replace('\n','')
print(" sup gs ", sup_gs_reward)
rl_prep_time= float(open(graph_path+'_num_k_{}_time_nbs{}.txt'.format(budget, sampling_neighborhood),'r').readlines()[0].split('RL_PREP_TIME_')[1].replace('\n',''))
# print("rl time" ,rl_prep_time)
print("time",rl_prep_time,rl_time_taken)
total_gcomb_time = rl_prep_time+rl_time_taken
print("GCOMB",reward_gcomb, total_gcomb_time)
# out_gcomb_quality.write(str(budget) + "\t" + str(reward_gcomb) + "\n")
# out_gcomb_total_time.write(str(budget) + "\t" + str(total_gcomb_time) + "\n")
#
# out_greedy_quality.write(str(budget) + "\t" + str(greedy_reward) + "\n")
# out_greedy_time.write(str(budget) + "\t" + str(greedy_time) + "\n")
#
# out_supgs_quality.write(str(budget) + "\t" + str(sup_gs_reward) + "\n")
out_gcomb_quality.write(str(reward_gcomb)+"\n")
out_gcomb_total_time.write(str(total_gcomb_time)+"\n")
out_greedy_quality.write( str(greedy_reward)+"\n")
out_greedy_time.write( str(greedy_time)+"\n")
out_supgs_quality.write( str(sup_gs_reward)+"\n")
#out_supgs_time.write(str(budget) + "\t" + str(total_gcomb_time))
# print(rl_data, greedy_data, sup_gs_data)
#
#+"\t"+str(total_gcomb_time)+"\t" +str(greedy_reward)+"\t"+ str(greedy_time) +"\t"+ str(sup_gs_reward)