flambe.metric.metric

Module Contents

class flambe.metric.metric.Metric[source]

Bases: flambe.compile.Component

Base Metric interface.

Objects implementing this interface should take in a sequence of examples and provide as output a processd list of the same size.

compute(self, pred: torch.Tensor, target: torch.Tensor)[source]

Computes the metric over the given prediction and target.

Parameters:
  • pred (torch.Tensor) – The model predictions
  • target (torch.Tensor) – The ground truth targets
Returns:

The computed metric

Return type:

torch.Tensor

__call__(self, *args, **kwargs)[source]

Makes Featurizer a callable.

__str__(self)[source]

Return the name of the Metric (for use in logging).