Repository navigation
Expand file tree
/
Copy pathconfig.py
More file actions
54 lines (45 loc) · 1.85 KB
/
Copy pathconfig.py
File metadata and controls
54 lines (45 loc) · 1.85 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
import math
class Config:
"""Hyperparameter configuration for dynamic spiking GNN experiments."""
def __init__(self):
# Dataset settings
self.dataset = "Cora" # or "PubMed"
self.num_time_steps = 10 # total time steps
self.train_steps = 7 # first 7 for pre-training
self.adapt_steps = 2 # steps 8-9 for adaptation (STDP or surrogate)
self.test_step = 9 # last step (0-indexed: step 9) for evaluation
# Architecture
self.node_feat_dim = 1433 # Cora feature dimension
self.hidden_dim = 64
self.out_dim = 1 # link prediction score (binary)
self.num_layers = 2
self.num_heads = 8 # for GAT
self.dropout = 0.5
# Training
self.lr = 0.001
self.weight_decay = 5e-4
self.epochs_static = 200 # for baseline GNNs
self.epochs_pretrain = 100 # for spiking GNN pre-training
self.epochs_adapt = 10 # for fine-tuning or mask learning
self.batch_size = 64
self.seed = 42
self.device = "cuda:0"
# STDP hyperparameters
self.mask_initial_ratio = 0.95
self.stdp_learning_rate = 0.01
self.stdp_window = 5 # temporal window for spike coincidence
self.stdp_decay = 0.01
# Surrogate gradient
self.gumbel_tau = 1.0
self.mask_lr = 0.01
self.entropy_reg_lambda = 1e-3
# Energy estimation
self.num_macs_per_edge = 2 # approximate MAC cost per edge
self.spike_energy_pJ = 0.9 # pJ per spike (45nm CMOS)
self.mac_energy_pJ = 0.1 # pJ per MAC
self.static_energy_mW = 100 # mW idle
def to_dict(self):
"""Return configuration as a dictionary."""
return {k: v for k, v in self.__dict__.items() if not k.startswith('_')}
def __repr__(self):
return f"Config({self.to_dict()})"