-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathcreate_excel_for_bench.py
51 lines (36 loc) · 2.2 KB
/
create_excel_for_bench.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
import pandas as pd
import os
from prompt_graph.defines import GRAPH_TASKS
graph_dataset_name = GRAPH_TASKS
node_dataset_name = ['PubMed', 'CiteSeer', 'Cora', 'Wisconsin', 'Texas', 'ogbn-arxiv', 'Actor', 'Flickr']
shot_nums = [1,3,5]
for dataset_name in node_dataset_name:
for shot_num in shot_nums:
pre_train_types = ['None', 'DGI', 'GraphMAE', 'Edgepred_GPPT', 'Edgepred_Gprompt', 'GraphCL', 'SimGRACE']
prompt_types = ['None', 'GPPT', 'All-in-one', 'Gprompt', 'GPF', 'GPF-plus']
column_names = [f"{pre_train}+{prompt}" for prompt in prompt_types for pre_train in pre_train_types if pre_train != 'None' or prompt == 'None']
# 创建DataFrame
data = pd.DataFrame(columns=column_names, index=['Final Accuracy', 'Final F1', 'Final AUROC'])
gnn_type = 'GCN'
file_name = gnn_type +"_total_results.xlsx"
file_path = os.path.join('./Experiment/ExcelResults/Node/'+str(shot_num)+'shot/'+ dataset_name +'/', file_name)
if not os.path.exists(file_path):
os.makedirs(os.path.dirname(file_path), exist_ok=True)
data.to_excel(file_path)
# 打印信息确认文件已保存
print(f"Data saved to {file_path} successfully.")
for dataset_name in graph_dataset_name:
for shot_num in shot_nums:
pre_train_types = ['None', 'DGI', 'GraphMAE', 'Edgepred_GPPT', 'Edgepred_Gprompt', 'GraphCL', 'SimGRACE']
prompt_types = ['None', 'GPPT', 'All-in-one', 'Gprompt', 'GPF', 'GPF-plus']
column_names = [f"{pre_train}+{prompt}" for prompt in prompt_types for pre_train in pre_train_types if pre_train != 'None' or prompt == 'None']
# 创建DataFrame
data = pd.DataFrame(columns=column_names, index=['Final Accuracy', 'Final F1', 'Final AUROC'])
gnn_type = 'GCN'
file_name = gnn_type +"_total_results.xlsx"
file_path = os.path.join('./Experiment/ExcelResults/Graph/'+str(shot_num)+'shot/'+ dataset_name +'/', file_name)
if not os.path.exists(file_path):
os.makedirs(os.path.dirname(file_path), exist_ok=True)
data.to_excel(file_path)
# 打印信息确认文件已保存
print(f"Data saved to {file_path} successfully.")