MeanAbsoluteErrorInverse#

class torch_uncertainty.metrics.regression.MeanAbsoluteErrorInverse(unit='km', **kwargs)[source]#

Mean Absolute Error of the inverse predictions (iMAE).

\[\text{iMAE} = \frac{1}{N}\sum_i^N \left| \frac{1}{y_i} - \frac{1}{\hat{y_i}} \right|\]

Where \(y\) is a tensor of target values, and \(\hat{y}\) is a tensor of predictions. Both are scaled by a factor of unit_factor depending on the unit given.

As input to forward and update the metric accepts the following input:

  • preds (Tensor): Predictions from model

  • target (Tensor): Ground truth values

As output of forward and compute the metric returns the following output:

  • mean_absolute_inverse_error (Tensor): A tensor with the mean absolute error over the state

Parameters:
  • unit – Unit for the computation of the metric. Must be one of ‘mm’, ‘m’, ‘km’. Defauts to ‘km’.

  • kwargs – Additional keyword arguments.

update(preds, target)[source]#

Update state with predictions and targets.