Supervised Learning
Supervised Learning with FedDDL
This guide shows you how to set up a supervised learning workload on FedDDL. You only need to provide a model, dataset arrays, and a few training hyperparameters; the platform handles client partitioning, rounds, and aggregation.
Learn by doing?
See a full example of MNist running on the Obit network here!
What you need to provide
Model architecture: a compiled
tf.Sequential(or similar) model. Optimizers are supported; custom losses/metrics are not (use built-in Tensorflow.js losses/metrics).Flattened dataset:
inputandoutputarrays sized toTOTAL_SAMPLES * INPUT_SIZEandTOTAL_SAMPLES * OUTPUT_SIZErespectively. Labels should already be encoded (e.g., one-hot for classification).Test split (optional):
testInputandtestOutputarrays for evaluation.Training config:
TOTAL_SAMPLES,INPUT_SIZE,OUTPUT_SIZE,TOTAL_ROUNDS,BATCH_SIZE,EPOCHS_PER_ROUND,MIN_CLIENTS_TO_START.
Core class: SupervisedTrainingSession
SupervisedTrainingSessionCreate one session per workload. It:
Serves model + metadata to clients
Partitions data across clients on demand
Aggregates client weight segments
Optionally applies differential privacy (disabled by default)
Constructor signature:
Minimal example
Data shape and partitioning
Data is partitioned per client by slicing the flat arrays; ensure arrays are contiguous and sized correctly.
inputlength must equalTOTAL_SAMPLES * INPUT_SIZE.outputlength must equalTOTAL_SAMPLES * OUTPUT_SIZE(use one-hot labels for classification).
Constraints and tips
Avoid custom loss/metric functions; use built-in Tensorflow.js losses/metrics.
Metrics function is optional and runs on the server. Keep it lightweight to avoid logging overhead.
Choose
BATCH_SIZEandEPOCHS_PER_ROUNDbased on requirements of your model. Larger values increase compute required for clients.
What runs where
The server hosts the session, partitions data, and aggregates weight segments.
The client receives its data partition and trains the model.
Last updated