Note
Go to the end to download the full example code
Simple FedGraph Example#
Run a simple example of FedGraph.
(Time estimate: 1 minutes)
Load libraries#
import sys
sys.path.append("../fedgraph")
import attridict
import yaml
from fedgraph.federated_methods import FedGCN_Train
from fedgraph.utils import federated_data_loader
Load configuration and federated data#
config: {'dataset': 'cora', 'fedtype': 'fedgcn', 'global_rounds': 100, 'local_step': 3, 'learning_rate': 0.5, 'n_trainer': 2, 'num_layers': 2, 'num_hops': 2, 'gpu': False, 'iid_beta': 10000, 'logdir': './runs'}
Run FedGCN method#
FedGCN_Train(config, data)
server aggregates all local neighbor feature sums
clients received feature aggregation from server
global_rounds 100
average_final_test_loss, 0.9302511513233185
average_final_test_accuracy, 0.784
Total running time of the script: (0 minutes 20.277 seconds)