Evaluator¶
-
class
tfsnippet.
Evaluator
(loop, metrics, inputs, data_flow, feed_dict=None, time_metric_name='eval_time', batch_weight_func=<function auto_batch_weight>)¶ Bases:
object
Class to compute evaluation metrics.
It is a common practice to compute one or more metrics for evaluation and validation during the training process. This class provides a convenient interface for computing metrics by mini-batches.
The event schedule of an
Evaluator
can be briefly described as follows:events.fire(EventKeys.BEFORE_EXECUTION, self) ... # actually run the evaluation events.reverse_fire(EventKeys.AFTER_EXECUTION, self)
Attributes Summary
batch_weight_func
Get the function to compute the metric weight for each mini-batch. data_flow
Get the validation data flow. events
Get the event source object. feed_dict
Get the fixed feed dict. inputs
Get the input placeholders. last_metrics_dict
Get the metric values from last evaluation. loop
Get the training loop object. metrics
Get the metrics to compute. time_metric_name
Get the metric name for collecting evaluation time usage. Methods Summary
run
([feed_dict])Run evaluation. Attributes Documentation
-
batch_weight_func
¶ Get the function to compute the metric weight for each mini-batch.
-
events
¶ Get the event source object.
Returns: The event source object. Return type: EventSource
-
last_metrics_dict
¶ Get the metric values from last evaluation.
Returns: The metric values dict. Return type: dict[str, any]
-
metrics
¶ Get the metrics to compute.
Returns: The metrics to compute. Return type: OrderedDict[str, tf.Tensor]
-
time_metric_name
¶ Get the metric name for collecting evaluation time usage.
Methods Documentation
-