mean_absolute_error
[ allennlp.training.metrics.mean_absolute_error ]
MeanAbsoluteError#
@Metric.register("mean_absolute_error")
class MeanAbsoluteError(Metric):
| def __init__(self) -> None
This Metric calculates the mean absolute error (MAE) between two tensors.
__call__#
class MeanAbsoluteError(Metric):
| ...
| def __call__(
| self,
| predictions: torch.Tensor,
| gold_labels: torch.Tensor,
| mask: Optional[torch.BoolTensor] = None
| )
Parameters
- predictions :
torch.Tensor
A tensor of predictions of shape (batch_size, ...). - gold_labels :
torch.Tensor
A tensor of the same shape aspredictions. - mask :
torch.BoolTensor, optional (default =None)
A tensor of the same shape aspredictions.
get_metric#
class MeanAbsoluteError(Metric):
| ...
| def get_metric(self, reset: bool = False)
Returns
- The accumulated mean absolute error.
reset#
class MeanAbsoluteError(Metric):
| ...
| @overrides
| def reset(self)