fl4health.reporting.base_reporter module

Base Class for Reporters.

Super simple for now but keeping it in a separate file in case we add more base methods.

class BaseReporter[source]

Bases: object

initialize(**kwargs)[source]

Method for initializing reporters with client/server information

This method is called once by the client or server during initialization.

Parameters:

kwargs (Any) – arbitrary keyword arguments containing information from the client or server that might be useful for initializing the reporter. This information should be treated as optional and this method should work even if no keyword arguments are passed.

Return type:

None

report(data, round=None, epoch=None, step=None)[source]

A method called by clients or servers to send data to the reporter.

The report method is called by the client/server at frequent intervals (ie step, epoch, round) and sometimes outside of a FL round (for high level summary data). It is up to the reporter to determine when and what to report.

Parameters:
  • data (dict) – The data to maybe report from the server or client.

  • round (int | None, optional) – The current FL round. If None, this indicates that the method was called outside of a round (e.g. for summary information). Defaults to None.

  • epoch (int | None, optional) – The current epoch (In total across all rounds). If None then this method was not called at or within the scope of an epoch. Should always be None if training by steps. Defaults to None.

  • step (int | None, optional) – The current step (In total across all rounds and epochs). If None then this method was called outside the scope of a training or evaluation step (eg. at the end of an epoch or round) Defaults to None.

Return type:

None

shutdown()[source]

Called by the client/server on shutdown.

Return type:

None