Metrics

Evaluation metrics attach to Nodes (usually a Model Node) and tell you how well that Node performed. Metrics are created just like other Layers, but they have their own behaviour.
class megatron.layers.metrics.Metric(metric_fn, **kwargs)

Bases: object

Layer type that holds an evaluation metric; only incorporated for Pipeline evaluation.

Parameters:
  • metric_fn (function) – the metric function to be wrapped.
  • **kwargs – any keyword arguments to be passed to the metric when being called.
evaluate(*inputs)

Run metric function on given input data.