Help protect the Great Barrier Reef with TensorFlow on Kaggle Join Challenge


Utility class for saving metrics using tf.summary.

Inherits From: MetricsManager

This class is intended to log metrics so that they can be used with TensorBoard. Note that this supports both scalar and series data, which are logged via tf.summary.scalar and tf.summary.histogram, respectively.

summary_dir A path on the filesystem containing all outputs of the associated summary writer.

ValueError If root_metrics_dir is an empty string.
ValueError If summary_dir is an empty string.



View source

Clear out metrics at or after a given starting round_num.

Note that since save_metrics is only compatible with nonnegative integer round numbers, clear_metrics(round_num=0) corresponds to clearing all metrics previously saved via save_metrics.

round_num A nonnegative integer representing the starting round number for clearing metrics.


View source

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

The specified round_num must be later than the latest round number previously used with save_metrics. Note that we do not check whether the underlying summary writer has previously written any metrics with the given round_num. Thus, if the TensorboardManager is created from a directory containing previously written metrics, it may overwrite them. This is intended usage, allowing one to restart and resume experiments from previous rounds.

The metrics written by the underlying tf.summary.SummaryWriter will be the leaf node tensors of the metrics_to_append structure. Purely scalar tensors will be written using tf.summary.scalar, while tensors with non-zero rank will be written using tf.summary.histogram.

metrics A nested structure of metrics collected during round_num. The nesting will be flattened for purposes of writing to TensorBoard.
round_num Communication round at which metrics was collected.

A collections.OrderedDict of the metrics used to update the manager. Compared with the input metrics, this data is flattened, with the key names equal to the path in the nested structure, and round_num has been added as an additional key (overwriting the value if already present in the input metrics). The OrderedDict is sorted by the flattened keys.

ValueError If round_num is negative, or round_num is less than or equal to the last round number used with save_metrics.