Machine Learning Basics

Let p be the probability that a model outputs for the correct class. Which of the following describes the cross-entropy loss −log p used to train classifiers?

  1. AThe closer p is to 1, the closer the loss is to 0, and as p approaches 0 the loss grows sharply
  2. BRegardless of the value of p, the loss is proportional to the square of the difference between the correct answer and the prediction
  3. CThe loss is largest when p is 0.5 and becomes smaller as p approaches 0 or 1
Show answer and explanation

Answer: A. The closer p is to 1, the closer the loss is to 0, and as p approaches 0 the loss grows sharply

The cross-entropy loss is −log 1 = 0 when the probability p assigned to the correct class is 1, grows as p becomes smaller, and grows without limit as p approaches 0. With the natural logarithm it is about 0.69 for p = 0.5 and about 2.3 for p = 0.1. Because it heavily penalizes confident wrong predictions, it is widely used for classification models that output probabilities through the softmax or sigmoid function. The mean squared error, which uses squared errors, is used mainly for regression, which predicts continuous values.

  • A. Correct. The loss is 0 when p is 1 and grows as p approaches 0.
  • B. Using the square of the difference is the mean squared error.
  • C. The loss decreases as p increases; it is not largest at p = 0.5.
Practice this topic Back to topic

Related calculators

Books on Machine Learning Basics Ad

As an Amazon Associate I earn from qualifying purchases.

More Machine Learning Basics questions

  1. In gradient descent, the gradient of the loss ∂L/∂w at weight w = 2.0 is 0.5 and the learning rate is 0.1. What is the weight after one update?
  2. When the derivative dy/dx of y = (2x + 1)² at x = 1 is found by the chain rule with u = 2x + 1 and y = u², which value is correct?
  3. In a neural network with many stacked layers, which of the following is the reason that using the sigmoid function as the activation function makes the layers near the input hard to train?
  4. A model is trained on 10,000 training samples with a mini-batch size (batch size) of 50. How many weight updates are there in one epoch?
  5. How many trainable parameters does a fully connected layer with 64 inputs and 32 outputs (one bias per output) have?