According to the PyTorch documentation for the Binary Cross Entropy Loss, we can write it as follows:

$$l_{n} = -w_{n}\cdot \left[y_{n}\cdot \log \left(x_{n}\right) + \left( 1-y_{n}\right)\cdot \log\left( 1-x_{n}\right) \right].$$

What do the $w_{n}$, $x_{n}$ and $y_{n}$ mean?


If you look at the documentation of the BCELoss you will the that they mean the following:

  • $w$ is the weight to use, by which the loss will be rescaled.
  • $x$ is the output value, which is the value that is predicted by the model.
  • $y$ is the target value, which is the ground truth value.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy