DefaultMetricFormatter

class tfsnippet.DefaultMetricFormatter

Bases: tfsnippet.scaffold.logging_.MetricFormatter

Default training metric formatter.

The time metrics (names ending with “time” or “timer”) should be placed before all other metrics. 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_ORDERS

Methods 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>)]

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:

str

sort_metrics(names)

Sort the names of metrics.

Parameters:names – Iterable metric names.
Returns:Sorted metric names.
Return type:list[str]