Machine Learning Basics
In a three-class classification, the values input to the softmax function (logits) are 3, 1 and 0. About how many times the second class's output (probability) is the first class's output? Which is closest?
- A2 times
- B3 times
- C7.4 times
Show answer and explanation
Answer: C. 7.4 times
The softmax function turns each value zᵢ into exp(zᵢ) ÷ Σexp(zⱼ), giving probabilities that sum to 1. The denominator is the same for every class, so the ratio of two classes' outputs is exp(3) ÷ exp(1) = e² ≈ 7.4. The ratio of the outputs thus depends only on the difference of the logits, and a difference of 2 makes the probability about 7.4 times larger. Adding the same number to all the logits does not change the outputs.
- A. This is the difference of the logits. In the softmax function, the difference becomes a ratio through the exponential function.
- B. This is the ratio of the logits, 3 ÷ 1, not the ratio of the softmax outputs.
- C. Correct. exp(3) ÷ exp(1) = e² ≈ 7.4.