Softmax⁡\operatorname{Softmax}

Softmax

Read "softmax of z". It turns any list of numbers into probabilities: every output is positive and they add up to 1. Bigger inputs get bigger shares.

Softmax⁡(z)i=ezi/∑jezj\operatorname{Softmax}(\mathbf{z})_i = e^{z_i} / \sum_j e^{z_j}. Taking ee to the power of each input makes every value positive. Dividing by the total makes them add up to 1.

It is called soft because it does not just pick the largest input (that would be a "hard" max). Larger inputs get a larger share, but every entry keeps some probability above zero. Only the differences between inputs matter: adding the same constant to every input leaves the output unchanged.

Example

Softmax⁡([2, 1, 0])≈[0.665, 0.245, 0.090]\operatorname{Softmax}([2,\, 1,\, 0]) \approx [0.665,\, 0.245,\, 0.090]

A difference of 1 between two inputs becomes a ratio of e ≈ 2.7 between their probabilities: 0.665 / 0.245 ≈ 2.7.

Where the course uses it

Related terms