trw.callbacks.callback_reporting_best_metrics

Module Contents

Classes

CallbackReportingBestMetrics

Report the best value of the history and epoch for each metric

Functions

collect_best_metrics(current_metrics, history_step, metric_to_discard, epoch)

Collect the best metrics between existing best metrics and a new history step

Attributes

logger

trw.callbacks.callback_reporting_best_metrics.logger
trw.callbacks.callback_reporting_best_metrics.collect_best_metrics(current_metrics, history_step, metric_to_discard, epoch)

Collect the best metrics between existing best metrics and a new history step

The best metric dictionary is encoded dataset_name#split_name#output_name#metric_name.

Parameters
  • current_metrics – store the existing best metrics

  • history_step – new time step to evaluate

  • metric_to_discard – metric names to discard

  • epoch – the history_step epoch

Returns

dict representing the current best metrics

class trw.callbacks.callback_reporting_best_metrics.CallbackReportingBestMetrics(table_name='best_metrics', metric_to_discard=None, epoch_start=0)

Bases: trw.callbacks.callback.Callback

Report the best value of the history and epoch for each metric

This can be useful to accurately get the best value of a metric and in particular at which step it occurred.

first_epoch(self, options)
__call__(self, options, history, model, losses, outputs, datasets, datasets_infos, callbacks_per_batch, **kwargs)