DefaultMetricFormatter¶
-
class
tfsnippet.DefaultMetricFormatter¶ Bases:
tfsnippet.scaffold.logs.MetricFormatterDefault training metric formatter.
This class sorts the metrics as follows:
- The metrics are first divided into groups according to the suffices
of their names as follows:
- Names ending with “time” or “timer” should come the first;
- Other metrics should come the second;
- Names ending with “loss” or “cost” should come the third;
- Names ending with “acc”, “accuracy”, “nll”, “lb” or “lower_bound” should come the fourth.
- The metrics are then sorted according to their names, within each group.
The values of the metrics would be formatted into 6-digit real numbers, except for metrics with “time” or “timer” as suffices in their names, which would be formatted using
humanize_duration().Attributes Summary
METRIC_ORDERSMethods Summary
format_metric(name, value)Format the value of specified metric. sort_metrics(names)Sort the names of metrics. Attributes Documentation
-
METRIC_ORDERS= ((-1, <_sre.SRE_Pattern object>), (998, <_sre.SRE_Pattern object>), (999, <_sre.SRE_Pattern object at 0x59f6f40>))¶
Methods Documentation
-
format_metric(name, value)¶ Format the value of specified metric.
Parameters: - name – Name of the metric.
- value – Value of the metric.
Returns: Human readable string representation of the metric value.
Return type:
- The metrics are first divided into groups according to the suffices
of their names as follows: