Server Class#

class fedgraph.server_class.Server(feature_dim: int, args_hidden: int, class_num: int, device: device, trainers: list, args: Any)[source]#

This is a server class for federated learning which is responsible for aggregating model parameters from different clients, updating the central model, and then broadcasting the updated model parameters back to the trainers.

Parameters:
  • feature_dim (int) – The dimensionality of the feature vectors in the dataset.

  • args_hidden (int) – The number of hidden units.

  • class_num (int) – The number of classes for classification in the dataset.

  • device (torch.device) – The device initialized for the server model.

  • trainers (list[Trainer_General]) – A list of Trainer_General instances representing the trainers.

  • args (Any) – Additional arguments required for initializing the server model and other configurations.

model#

The central GCN model that is trained in a federated manner.

Type:

[AggreGCN, GCN_arxiv, SAGE_products, GCN]

trainers#

The list of trainer instances.

Type:

list[Trainer_General]

num_of_trainers#

The number of trainers.

Type:

int

broadcast_params(current_global_epoch: int) None[source]#

Broadcasts the current parameters of the central model to all trainers.

Parameters:

current_global_epoch (int) – The current global epoch number during the federated learning process.

train(current_global_epoch: int) None[source]#

Training round which perform aggregating parameters from trainers, updating the central model, and then broadcasting the updated parameters back to the trainers.

Parameters:

current_global_epoch (int) – The current global epoch number during the federated learning process.

zero_params() None[source]#

Zeros out the parameters of the central model.