GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — DGCluster/plots_num_clusters.py at master · pyrobits/DGCluster Expand file tree/ Copy pathplots_num_clusters.pyMore file actions 95 lines (79 loc) · 3.1 KB / Copy pathplots_num_clusters.pyFile metadata and controls95 lines (79 loc) · 3.1 KB 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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 import numpy as np import matplotlib.pyplot as plt from matplotlib import rcParams import copy import torch import math rcParams['pdf.fonttype'] = 42 rcParams['ps.fonttype'] = 42 dataset_names = ['cora', 'citeseer', 'pubmed', 'computers', 'photo', 'coauthorcs', 'coauthorphysics'] dataset_name_map = { 'cora': "Cora", 'citeseer': "CiteSeer", 'pubmed': "PubMed", 'computers': "Amazon PC", 'photo': "Amazon Photo", 'coauthorcs': "Coauthor CS", 'coauthorphysics': "Coauthor PHY" } markers = { "cora": "v", "citeseer": "^", "pubmed": "<", "computers": ">", "photo": "P", "coauthorcs": "X", "coauthorphysics": "D", } colors = { "cora": "r", "citeseer": "m", "pubmed": "g", "computers": "c", "photo": "b", "coauthorcs": "y", "coauthorphysics": "k", } evaluation_keys = ['num_clusters'] results = {dataset: {} for dataset in dataset_names} for dataset in dataset_names: for evaluation_key in evaluation_keys: result_dataset_eval = [] result_dataset_eval_std = [] for lam in [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]: results_dataset = [] for seed in range(10): path = f"results/results_{dataset}_{lam}_300_gcn_{seed}.pt" results_dataset.append(torch.load(path)[evaluation_key]) result_dataset_eval.append(np.mean(results_dataset)) result_dataset_eval_std.append(np.std(results_dataset)) results[dataset][evaluation_key] = copy.deepcopy(result_dataset_eval) results[dataset][evaluation_key + '_std'] = copy.deepcopy(result_dataset_eval_std) fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(4, 3), sharex=True) labelsize = 14 ticksize = 12 markersize = 6 linewidth = 1.5 xticks = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8] ax = axes ls = [None] * len(dataset_names) for i, method_key in enumerate(dataset_names): ls[i], = ax.plot(xticks, results[method_key]['num_clusters'], label=method_key, marker=markers[method_key], color=colors[method_key]) ax.fill_between(xticks, np.array(results[method_key]['num_clusters']) - np.array(results[method_key]['num_clusters_std']), np.array(results[method_key]['num_clusters']) + np.array(results[method_key]['num_clusters_std']), alpha=0.2, color=colors[method_key]) ax.minorticks_off() ax.set_xticks(xticks) ax.set_xticklabels(xticks) ax.set_ylabel(r'#Communities', fontsize=labelsize) ax.tick_params(axis='x', labelsize=ticksize) ax.tick_params(axis='y', labelsize=ticksize) ax.grid(True) fig.add_subplot(111, frameon=False) plt.tick_params(labelcolor='none', top=False, bottom=False, left=False, right=False) plt.xlabel(r'$\lambda$', fontsize=labelsize) fig.tight_layout() fig.subplots_adjust(left=0.035, bottom=0.16, right=0.99, wspace=0.22) axes.legend(handles=ls, labels=[dataset_name_map[dataset_name] for dataset_name in dataset_names], loc='upper center', bbox_to_anchor=(0.45, -0.2), fancybox=False, shadow=False, ncol=math.ceil(len(dataset_names) / 2), fontsize=labelsize - 4) fig.savefig(f'plots/results_number_clusters.pdf', bbox_inches='tight') plt.show() |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |