fl4health.client_managers.base_sampling_manager module¶
- class BaseFractionSamplingManager[source]¶
Bases:
SimpleClientManager
Overrides the
SimpleClientManager
to Provide Fixed Sampling without replacement for Clients.- sample(num_clients, min_num_clients=None, criterion=None)[source]¶
Sample a number of Flower ClientProxy instances.
- Return type:
list
[ClientProxy
]
- sample_all(min_num_clients=None, criterion=None)[source]¶
Samples ALL available clients.
- Parameters:
min_num_clients (int | None, optional) – minimum number of clients to wait to become available before selecting all available clients. Defaults to None.
criterion (Criterion | None, optional) – Criterion used to filter returned clients. If none, no filter is applied. Defaults to None.
- Returns:
List of selected clients represented by
ClientProxy
objects.- Return type:
list[ClientProxy]
- sample_fraction(sample_fraction, min_num_clients=None, criterion=None)[source]¶
- Return type:
list
[ClientProxy
]
- sample_one(min_num_clients=None, criterion=None)[source]¶
Samples exactly one available client randomly. This should only be used for client-side parameter initialization.
- Parameters:
min_num_clients (int | None, optional) – minimum number of clients to wait to become available before selecting all available clients. Defaults to None.
criterion (Criterion | None, optional) – Criterion used to filter returned clients. If none, no filter is applied. Defaults to None.
- Returns:
Selected client represented by a ClientProxy object in list form as expected by server.
- Return type:
list[ClientProxy]