liveBook · Manning

Sigmoid

As explained in Natural Language Processing in Action, Second Edition

A logistic function is an S-shaped mathematical function that maps an input to a bounded continuous value and provides a soft threshold.

A sigmoid, or logistic function, is an S-shaped activation that converts a numeric input into a bounded continuous value. Its smooth transition acts as a soft threshold: outputs near zero and one can represent competing binary outcomes without making an abrupt yes-or-no decision. A single neuron using sigmoid activation is mathematically equivalent to logistic regression; the distinction lies in how the model is trained. section 5.1.4 section 5.2

Changing the curve

The Python implementation accepts a weight, phase, and gain. Changing the weight makes the transition steeper or flatter, while changing the phase shifts where the transition occurs. Plotting several parameter combinations makes these scaling effects visible before using the function inside a model.

Sigmoid connects naturally to classification workflows:

  • Use it after a weighted linear combination of features to produce a binary-classification probability. section 5.1.4 section 5.2.5
  • Feed it bag-of-words or TF-IDF vectors when classifying text with a single neuron. section 5.1.4 section 5.2.5
  • Apply it element-wise for multi-label tagging, where each output independently represents the probability of one label. section 8.2.4
  • Prefer binary cross-entropy for binary classification rather than treating the task as regression with mean squared error. section 5.2.5

How Natural Language Processing in Action, Second Edition covers it

How deep it goes
Explains the S-shaped behavior, parameter effects, model equivalence, PyTorch implementation, training loss, and multi-label use.
Examples
Uses plotted logistic curves, PyTorch name classification, binary cross-entropy, training metrics, and predictions for sample names.
What it assumes
Assumes weighted features and classification basics while building from familiar logistic regression and text-vector representations.
What you can do after
Build it from scratch with NumPy or PyTorch, and apply it to binary classification or independent multi-label prediction.
How it connects
Connects sigmoid with logistic regression, perceptrons, binary classification, TF-IDF, bag-of-words, softmax, and multi-label classification.

Also explained in

Compare how 16 books explain sigmoid →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Natural Language Processing in Action, Second Edition. The section links point to the parts of the book it draws on.