tff.simulation.DictionaryMetricsManager

A manager for keeping metrics in memory using an ordered dictionary.

Inherits From: MetricsManager

Note that this class stores all metrics in memory, and may be prohibitively expensive in large-scale simulations, especiall those storing large tensor metrics.

latest_round_num The last round number passed to save_metrics.

If no metrics have been written, this will be None, otherwise it will be a nonnegative integer.

metrics Retrieve the stored experiment metrics data for all rounds.

Methods

clear_metrics

View source

Clear out metrics at and after a given starting round_num.

Note that if clear_metrics(round_num=0) is called, all metrics are cleared in a more performant manner. Rather than removing all keys associated to round numbers after round_num, we simply clear the entire dictionary.

Args
round_num A nonnegative integer indicating the starting round number for clearing metrics from the manager's associated dictionary.

Raises
ValueError If round_num is negative.

save_metrics

View source

Updates the stored metrics data with metrics for a specific round.

Args
metrics A nested structure of metrics collected during round_num.
round_num Integer round at which metrics was collected.

Raises
ValueError If round_num is negative.
ValueError If round_num is less than or equal to the latest round number used to save metrics.