p2pfl.examples.mnist moduleΒΆ

Example of a P2PFL MNIST experiment, using a MLP model and a MnistFederatedDM.

p2pfl.examples.mnist.create_pytorch_model()[source]ΒΆ

Create a PyTorch model.

Return type:

P2PFLModel

p2pfl.examples.mnist.create_tensorflow_model()[source]ΒΆ

Create a TensorFlow model.

Return type:

P2PFLModel

p2pfl.examples.mnist.mnist(n, r, e, show_metrics=True, measure_time=False, protocol='grpc', framework='pytorch', aggregator='fedavg', reduced_dataset=False, topology=TopologyType.LINE)[source]ΒΆ

P2PFL MNIST experiment.

Parameters:
  • n (int) – The number of nodes.

  • r (int) – The number of rounds.

  • e (int) – The number of epochs.

  • show_metrics (bool) – Show metrics.

  • measure_time (bool) – Measure time.

  • protocol (str) – The protocol to use.

  • framework (str) – The framework to use.

  • aggregator (str) – The aggregator to use.

  • reduced_dataset (bool) – Use a reduced dataset just for testing.

  • topology (TopologyType) – The network topology (star, full, line, ring).

Return type:

None

p2pfl.examples.mnist.set_standalone_settings(disable_ray=False)[source]ΒΆ

Set settings for testing. :rtype: None

Important

  • HEARTBEAT_PERIOD: Too high values can cause late node discovery/fault detection. Too low values can cause high CPU usage.

  • GOSSIP_PERIOD: Too low values can cause high CPU usage.

  • TTL: Low TTLs can cause that some messages are not delivered.