liveBook · Manning

Sigmoid

As explained in Knowledge Graphs and LLMs in Action

A sigmoid activation maps a real-valued score to a value between zero and one, commonly interpreted as a probability for a binary outcome.

A sigmoid activation converts a real-valued score into a probability between zero and one. In binary prediction, this makes a model’s output interpretable as the likelihood of a class or link. section 9.3.1 section 12.2.4

A practical sigmoid-based prediction pipeline follows these steps:

  • Generate feature vectors or embeddings for the entities being classified, such as graph nodes or users and movies. section 9.3.1 section 12.2.4
  • Compute a score from the representations. Logistic regression uses a linear combination of features, while link prediction uses a user–movie dot product. section 9.3.1 section 12.2.4
  • Apply sigmoid to convert the score into a probability, then compare that probability with the binary interaction label during optimization. section 12.2.4

Movie recommendation link prediction

A heterogeneous GNN produces user and movie embeddings. A dot product scores each potential user–movie interaction; sigmoid converts the score into the probability that the link exists. PyTorch’s F.binary_cross_entropy_with_logits combines the sigmoid operation with binary cross-entropy loss for training. section 12.2.4

Figure 12.9 Pipeline for processing heterogeneous graph data in a link prediction system for movie recommendations. The data consists of users and movies as node types and user–movie ratings as edges. Embeddings are generated, with user embeddings learned by the model and movie embeddings initialized from genre features. The data is processed using three heterogeneous GNN encoders (H-GraphConv, H-GAT, and H-SAGE), which aggregate neighbor features to generate node representations. A dot product then quantifies the compatibility between users and movies, with higher scores indicating a greater likelihood of interaction. The scores are finally converted into probabilities representing the likelihood of a link between users and movies.
figure

Follow the complete heterogeneous-graph pipeline from node embeddings and GNN encoders through dot-product compatibility scores and final link probabilities. section 12.2.4

How Knowledge Graphs and LLMs in Action covers it

How deep it goes
Explains score-to-probability conversion and loss integration, but does not derive the sigmoid mathematically.
Examples
Uses graph-node classification and user–movie recommendation link prediction as concrete applications.
What you can do after
Apply it via PyTorch’s F.binary_cross_entropy_with_logits to train probability-producing link-prediction models.
How it connects
Connects logistic regression, dot products, binary cross-entropy loss, graph neural networks, and link prediction.

Also explained in

Compare how 16 books explain sigmoid →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Knowledge Graphs and LLMs in Action. The section links point to the parts of the book it draws on.