kliff.trainer.utils.losses

kliff.trainer.utils.losses.MSE_loss(predictions, targets, weights=1.0)[source]

Compute the mean squared error (MSE) of the residuals, with the option to weight the residuals.

Parameters:
  • predictions (Union[ndarray, Tensor]) – The predicted values.

  • targets (Union[ndarray, Tensor]) – The target values.

  • weights (Union[ndarray, Tensor]) – The weights to apply to the residuals. Default is 1.0.

Return type:

Union[ndarray, Tensor]

Returns:

The MSE of the residuals.

kliff.trainer.utils.losses.MAE_loss(predictions, targets, weights=1.0)[source]

Compute the mean absolute error (MAE) of the residuals, with the option to weight the residuals.

Parameters:
  • predictions (Union[ndarray, Tensor]) – The predicted values.

  • targets (Union[ndarray, Tensor]) – The target values.

  • weights (Union[ndarray, Tensor]) – The weights to apply to the residuals. Default is 1.0.

Return type:

Union[ndarray, Tensor]

Returns:

The MAE of the residuals.