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(network_id: str, repository: Repository, db: DatabaseConnection)[source]
Bases:
ControlBase
Controller, implementing the overall global training, validation and prediction logic.
- Parameters:
statestore (class: fedn.network.statestorebase.StateStorageBase) – A StateStorage instance.
- __init__(network_id: str, repository: Repository, db: DatabaseConnection)[source]
Constructor method.
- classmethod create_instance(network_id: str, repository: Repository, db: DatabaseConnection) Control [source]
Create a singleton instance of the Control class.
- Parameters:
network_id (str) – The network ID.
repository (Repository) – The repository instance.
db (DatabaseConnection) – The database connection instance.
- Returns:
The Control instance.
- Return type:
- predict_instruct(config)[source]
Main entrypoint for executing the prediction compute plan.
: param config: configuration for the prediction round
- prediction_round(config)[source]
Execute a prediction round.
: param config: configuration for the prediction round
- prediction_session(config: RoundConfig) None [source]
Execute a new prediction session.
- Parameters:
config (PredictionConfig) – The round config.
- Returns:
None
- 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: SessionConfigDTO, round_id: str, session_id: str, model_name: str | None = None, client_ids: list[str] | None = None) tuple [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
- splitlearning_round(session_config: SessionConfigDTO, round_id: str, session_id: str)[source]
Execute one global split learning round
- Parameters:
session_config (SessionConfigDTO) – The session config
round_id (str) – The round id
session_id (str) – The session id
- exception fedn.network.controller.control.MisconfiguredStorageBackend(message)[source]
Bases:
Exception
Exception class for when storage backend is misconfigured.
- Parameters:
message (str) – The exception message.
- exception fedn.network.controller.control.NoModelException(message)[source]
Bases:
Exception
Exception class for when model is None
- Parameters:
message (str) – The exception message.