liveBook · Manning

Sigmoid

As explained in Grokking Machine Learning

A function that maps a real-valued input to a value between zero and one, commonly interpreted as a binary class probability.

How happy is a sentence, rather than just happy or sad? A sigmoid turns a classifier’s real-valued score into a value between 0 and 1. Negative scores map below 0.5, zero maps to 0.5, and positive scores map above 0.5. The function is continuous and differentiable everywhere. section 6.1

From score to value

For inputs −5, 0, and 5, the sigmoid outputs approximately 0.007, 0.5, and 0.993. In a sentence-happiness classifier, these values represent predictions from very unlikely to very likely to be happy. section 6.1

Figure 6.3 Left: The step function used to build discrete perceptrons. It outputs a value of 0 for any negative input and a value of 1 for any input that is positive or zero. It has a discontinuity at zero. Right: The sigmoid function used to build continuous perceptrons. It outputs values less than 0.5 for negative inputs and values greater than 0.5 for positive inputs. At zero, it outputs 0.5. It is continuous and differentiable everywhere.

Compare the sigmoid’s smooth transition with the step function’s abrupt switch between 0 and 1. section 6.1

How Grokking Machine Learning covers it

How deep it goes
Explains the input-output pattern, midpoint, continuity, differentiability, and contrast with the step function.
Examples
Uses sentence-happiness predictions and sample sigmoid outputs for inputs from −5 to 5.
What it assumes
Builds on perceptron scoring and the step function; familiarity with the perceptron algorithm is helpful.
What you can do after
Understand how sigmoid scores become continuous class predictions, with 0.5 separating two classes.
How it connects
Connects sigmoid to perceptrons, logistic regression, and the step function.

Also explained in

Compare how 16 books explain sigmoid →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Machine Learning. The section links point to the parts of the book it draws on.