Shortcuts

MeanSquaredErrorInverse

class torch_uncertainty.metrics.regression.MeanSquaredErrorInverse(squared=True, num_outputs=1, unit='km', **kwargs)[source]

Mean Squared Error of the inverse predictions (iMSE).

\[\text{iMSE} = \frac{1}{N}\sum_i^N(\frac{1}{y_i} - \frac{1}{\hat{y_i}})^2\]
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_squared_error (Tensor): A tensor with the mean

    squared error

Parameters:
  • squared – If True returns MSE value, if False returns RMSE value.

  • num_outputs – Number of outputs in multioutput setting.

  • 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.