fedn.network.controller package
The controller package is responsible for orchestrating the federated learning process. It’s acts as a gRPC client and sends round config tasks
to the fedn.network.combiner.Combiner
.
Submodules
fedn.network.controller.control module
- exception fedn.network.controller.control.CombinersNotDoneException(message)[source]
Bases:
Exception
Exception class for when model is None
- class fedn.network.controller.control.Control(statestore)[source]
Bases:
ControlBase
Controller, implementing the overall global training, validation and inference logic.
- Parameters:
statestore (class: fedn.network.statestorebase.StateStorageBase) – A StateStorage instance.
- infer_instruct(config)[source]
Main entrypoint for executing the inference compute plan.
: param config: configuration for the inference round
- inference_round(config)[source]
Execute an inference round.
: param config: configuration for the inference round
- reduce(combiners)[source]
Combine updated models from Combiner nodes into one global model.
: param combiners: dict of combiner names(key) and model IDs(value) to reduce : type combiners: dict
- round(session_config, round_id)[source]
Execute one global round.
: param session_config: The session config. : type session_config: dict : param round_id: The round id. : type round_id: str
- exception fedn.network.controller.control.MisconfiguredStorageBackend(message)[source]
Bases:
Exception
Exception class for when storage backend is misconfigured.
- Parameters:
message (str) – The exception message.
fedn.network.controller.controlbase module
- class fedn.network.controller.controlbase.ControlBase(statestore)[source]
Bases:
ABC
- Base class and interface for a global controller.
Override this class to implement a global training strategy (control).
- Parameters:
statestore (
fedn.network.statestore.statestorebase.StateStoreBase
) – The statestore object.
- commit(model_id, model=None, session_id=None)[source]
Commit a model to the global model trail. The model commited becomes the lastest consensus model.
- evaluate_round_participation_policy(compute_plan, nr_active_clients)[source]
Evaluate policy for combiner round-participation. A combiner participates if it is responsive and reports enough active clients to participate in the round.
- evaluate_round_validity_policy(round)[source]
Check if the round is valid.
At the end of the round, before committing a model to the global model trail, we check if the round validity policy has been met. This can involve e.g. asserting that a certain number of combiners have reported in an updated model, or that criteria on model performance have been met.
- Parameters:
round – The round object
- Rtype round:
dict
- Returns:
True if the policy is met, otherwise False
- Return type:
- get_helper()[source]
Get a helper instance from global config.
- Returns:
Helper instance.
- Return type:
fedn.utils.plugins.helperbase.HelperBase
- get_participating_combiners(combiner_round_config)[source]
Assemble a list of combiners able to participate in a round as descibed by combiner_round_config.
- get_state()[source]
Get the current state of the controller.
- Returns:
The current state.
- Return type:
- idle()[source]
Check if the controller is idle.
- Returns:
True if idle, False otherwise.
- Return type:
- request_model_updates(combiners)[source]
Ask Combiner server to produce a model update.
- Parameters:
combiners (tuple (combiner, comboner_round_config)) – A list of combiners
- set_round_data(round_id, round_data)[source]
Set round data.
- Parameters:
round_id (str) – The round unique identifier
round_data – The status