Skip to content

Commit

Permalink
update gcns
Browse files Browse the repository at this point in the history
  • Loading branch information
ChenS676 committed May 19, 2024
1 parent 3f75916 commit d714c8e
Show file tree
Hide file tree
Showing 8 changed files with 382 additions and 251 deletions.
2 changes: 1 addition & 1 deletion core/gcns/gsaint_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,4 @@ def get_loader_RW(data, batch_size, walk_length, num_steps, sample_coverage):

# best_auc_metric, result_all_run = trainer.result_statistic()

print(f"best_auc_metric: {best_auc_metric}, result_all_run: {result_all_run}")
# print(f"best_auc_metric: {best_auc_metric}, result_all_run: {result_all_run}")
2 changes: 1 addition & 1 deletion core/gcns/heart_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from graphgps.network.heart_gnn import (GCN, GAT, SAGE, mlp_score)
from data_utils.load import load_data_lp
from utils import Logger, save_emb, get_root_dir, get_logger, config_device, set_cfg, get_git_repo_root_path
from trainer_heart import train, test, test_edge
from core.graphgps.train.trainer_heart import train, test, test_edge


def get_config_dir():
Expand Down
43 changes: 22 additions & 21 deletions core/gcns/text_plot.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
import matplotlib.pyplot as plt
import numpy as np

# 生成一些随机数据
data1 = np.random.randn(1000) # 第一组数据
data2 = np.random.rand(1000) * 100 # 第二组数据
# 生成示例数据
data = np.load('/hkfs/work/workspace/scratch/cc7738-benchmark_tag/TAPE_chen/core/gcns/data_seal.npz')
data1 = data['pos_pred']
data2 = data['neg_pred']

# 创建一个新的图形
fig, ax1 = plt.subplots()

# 绘制第一个直方图 (左轴)
color1 = 'blue'
ax1.hist(data1, bins=30, alpha=0.7, color=color1, edgecolor='black')
ax1.set_xlabel('Value')
ax1.set_ylabel('Frequency (Data 1)', color=color1)
ax1.tick_params(axis='y', labelcolor=color1)
# 创建图形和主轴
fig, ax = plt.subplots(figsize=(10, 6))

# 创建一个共享x轴的第二个y轴
ax2 = ax1.twinx()
# 创建左侧直方图
ax_left = ax.twiny() # 创建一个共享y轴的次坐标轴
ax_left.hist(data1, bins=30, orientation='horizontal', color='blue', edgecolor='black', alpha=0.7)
ax_left.invert_xaxis() # 反转x轴,使柱状图朝向中心
ax_left.set_xlabel('Count (Left Histogram)')
ax_left.set_ylabel('Frequency')
ax_left.set_title('Histograms Facing Each Other')

# 绘制第二个直方图 (右轴)
color2 = 'red'
ax2.hist(data2, bins=30, alpha=0.7, color=color2, edgecolor='black')
ax2.set_ylabel('Frequency (Data 2)', color=color2)
ax2.tick_params(axis='y', labelcolor=color2)
# 创建右侧直方图
ax.hist(data2, bins=30, orientation='horizontal', color='green', edgecolor='black', alpha=0.7)
ax.set_xlabel('Count (Right Histogram)')
ax.yaxis.tick_right() # y轴刻度标签显示在右侧
ax.yaxis.set_label_position("right")

# 调整布局
plt.tight_layout()

# 添加标题
plt.title('Dual-Axis Histogram')

# 显示图形
plt.savefig('hah')
plt.savefig('/hkfs/work/workspace/scratch/cc7738-benchmark_tag/TAPE_chen/core/gcns/hah.png')
227 changes: 0 additions & 227 deletions core/gcns/trainer_heart.py

This file was deleted.

2 changes: 1 addition & 1 deletion core/gcns/universal_tune.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def parse_args() -> argparse.Namespace:
'GraphSage': 'core/yamls/cora/gcns/graphsage.yaml'
}

def project_main():
def project_main(): # sourcery skip: avoid-builtin-shadow # sourcery skip: avoid-builtin-shadow

# process params
args = parse_args()
Expand Down
Binary file added core/graphgps/visualization/data_gsaint.npz
Binary file not shown.
Binary file added core/graphgps/visualization/data_seal.npz
Binary file not shown.
357 changes: 357 additions & 0 deletions core/graphgps/visualization/pos_neg_plot-2.ipynb

Large diffs are not rendered by default.

0 comments on commit d714c8e

Please # to comment.