logo

Module neuronika::nn::loss[][src]

Expand description

Loss functions.

The purpose of a loss function is to compute the quantity that a model should seek to minimize during training.

All losses are provided via function handles.

Regression losses

  • mse_loss - Measures the mean squared error between each element in the input and the target.

  • mae_loss - Measures the mean absolute error between each element in the input and the target.

Probabilistic losses

  • bce_loss - Measures the binary cross entropy between the target and the input.

  • bce_with_logits_loss - Measures the binary cross entropy with logits between the target and the input.

  • nll_loss - Measures the negative log likelihood between the target and the input.

  • kldiv_loss - Measures the Kullback-Leibler divergence between the target and the input.

Enums

Specifies the reduction to apply to the loss output.

Functions

Computes the binary cross entropy between the target y and input x.

Computes the binary cross entropy with logits between the target y and input x.

Computes the Kullback-Leibler divergence between the target and the input.

Computes the mean absolute error (MAE) between each element in the input x and target y.

Computes the mean squared error (squared L2 norm) between each element in the input x and target y.

Computes the negative log likelihood between the target y and input x.