Softmax function

Turns a vector of K real numbers into a vector of K positive values that sum to one, so they can be read as probabilities. It is widely used as the output layer of classification models such as neural networks.

\sigma(\mathbf{z})_j = \frac{e^{z_j}}{\sum_{k=1}^{K} e^{z_k}}

What the symbols mean

input vector of K real-valued scores (logits)
probability assigned to the j-th class, between 0 and 1
score of the j-th component of the input vector
score of the k-th component, summed over all K components
number of classes or components in the vector
Euler's number, the base of the natural exponential

About this formula

  • FieldComputer science
  • TopicMachine learning
  • LevelUniversity
  • Also callednormalized exponential function, softargmax, softmax activation function
  • SourceWikidata Q7554146

Write it in Obsidian

MathLive is a free visual math editor for Obsidian. Run Find a formula, type “softmax function”, and it goes into your note as editable LaTeX. You can also scan formulas from screenshots, PDFs and handwriting.

Related formulas