Class - PercentagePolicy#

class openfl.component.aggregator.straggler_handling.PercentagePolicy(percent_collaborators_needed=1.0, minimum_reporting=1, **kwargs)[source]#

Bases: StragglerPolicy

Percentage based Straggler Handling function.

__init__(percent_collaborators_needed=1.0, minimum_reporting=1, **kwargs)[source]#

Initialize a PercentagePolicy object.

Parameters:
  • percent_collaborators_needed (float, optional) – The percentage of collaborators needed. Defaults to 1.0.

  • minimum_reporting (int, optional) – The minimum number of collaborators that should report. Defaults to 1.

  • **kwargs – Variable length argument list.

Methods

__init__([percent_collaborators_needed, ...])

Initialize a PercentagePolicy object.

reset_policy_for_round()

Not required in PercentagePolicy.

start_policy(**kwargs)

Not required in PercentagePolicy.

straggler_cutoff_check(...)

If percent_collaborators_needed and minimum_reporting collaborators have reported results, then it is time to end round early.

reset_policy_for_round()[source]#

Not required in PercentagePolicy.

Return type:

None

start_policy(**kwargs)[source]#

Not required in PercentagePolicy.

Return type:

None

straggler_cutoff_check(num_collaborators_done, num_all_collaborators)[source]#

If percent_collaborators_needed and minimum_reporting collaborators have reported results, then it is time to end round early.

Parameters:
  • num_collaborators_done (int) – The number of collaborators that have reported.

  • all_collaborators (list) – All the collaborators.

  • num_all_collaborators (int)

Returns:

True if the straggler cutoff conditions are met, False

otherwise.

Return type:

bool