FedHP

Implementation of the FedHP: Federated Learning with Hyperspherical Prototypical Regularization [FedHP24] algorithm. .. rubric:: References

[FedHP24]

Samuele Fonio, Mirko Polato, Roberto Esposito. FedHP: Federated Learning with Hyperspherical Prototypical Regularization. In ESANN (2024). URL: https://www.esann.org/sites/default/files/proceedings/2024/ES2024-183.pdf

Classes included in fluke.algorithms.fedhp

ProtoNet

Wrapper network for the encoder model and the prototypes.

SeparationLoss

Large margin loss separation between hyperspherical protoypes.

FedHPClient

FedHPServer

FedHP

Classes

class fluke.algorithms.fedhp.ProtoNet(encoder: Module, n_protos: int, proto_size: int)[source]

Bases: Module

Wrapper network for the encoder model and the prototypes.

Parameters:
  • encoder (nn.Module) – The encoder model.

  • n_protos (int) – Number of prototypes.

  • proto_size (int) – Size of the prototypes.

class fluke.algorithms.fedhp.SeparationLoss(reduction: Literal['mean', 'sum'] = 'mean')[source]

Bases: Module

Large margin loss separation between hyperspherical protoypes.

Parameters:

reduction (str) – Specifies the reduction to apply to the output: ‘mean’ | ‘sum’.

class fluke.algorithms.fedhp.FedHPClient(index: int, model: Module, train_set: FastDataLoader, test_set: FastDataLoader, optimizer_cfg: OptimizerConfigurator, loss_fn: Module, local_epochs: int, n_protos: int, lam: float, fine_tuning_epochs: int = 0, **kwargs: dict[str, Any])[source]

Bases: PFLClient

class fluke.algorithms.fedhp.FedHPServer(model: Module, test_set: FastDataLoader, clients: Iterable[PFLClient], weighted: bool = True, n_protos: int = 10, embedding_size: int = 100, **kwargs: dict[str, Any])[source]

Bases: Server

class fluke.algorithms.fedhp.FedHP(n_clients: int, data_splitter: DataSplitter, hyper_params: DDict | dict[str, Any], **kwargs: dict[str, Any])[source]

Bases: PersonalizedFL