✳ BETWEEN QUESTIONS ML STUDY ATLAS

A QUESTION-LED LESSON

Softmax: How Do Scores Become a Probability Distribution?

A model can produce one score per class. Softmax turns a collection of scores, called logits, into nonnegative numbers that sum to one.

Three scores, one shared comparison

Imagine a model producing one score, or logit, for each of three classes. Softmax exponentiates each score and divides it by the sum of all three exponentials. The resulting weights are nonnegative and add to one.

Move one score

In the experiment, change the first logit while the other two stay fixed. All three weights can change: they share a denominator. Adding the same constant to every logit would leave the probabilities unchanged, because the common factor cancels. Raise the first logit while keeping the other two fixed. Its share grows, leaving less probability for the others because all three share a denominator.

INTERACTIVE EXPLORATION

Change one logit

Adjust the first of three logits. The other two are fixed at 1 and 0. Watch how probability is redistributed.

A distribution is not a guarantee

A larger weight is a larger relative preference within this particular set of classes. The fact that the numbers sum to one does not prove that the model is calibrated or that its top prediction is correct.

Check your understanding

If the same constant is added to all logits, do softmax probabilities change?

No. The common exponential factor cancels in the numerator and denominator.

Keep exploring

Probability ↗Logistic regression ↗

Further reading

Source and further reading ↗