fl4health.parameter_exchange.partial_parameter_exchanger module

class PartialParameterExchanger(parameter_packer)[source]

Bases: ParameterExchanger, Generic[T]

__init__(parameter_packer)[source]

Base class meant to properly facilitate partial parameter exchange through a selection criterion. This mechanism is more complicated than, for example, that used by the FixedLayerExchanger where the subset parameters to exchange do not change dynamically from round to round.

Parameters:

parameter_packer (ParameterPacker[T]) – Parameter packer that can be used to pack in more information than just the parameters being exchange. This is important, for example, when exchanging different sets of layers in each round.

pack_parameters(model_weights, additional_parameters)[source]
Return type:

list[ndarray[Any, dtype[Any]]]

abstract select_parameters(model, initial_model=None)[source]
Return type:

tuple[list[ndarray[Any, dtype[Any]]], TypeVar(T)]

unpack_parameters(packed_parameters)[source]
Return type:

tuple[list[ndarray[Any, dtype[Any]]], TypeVar(T)]