liveBook · Manning

Similarity matrix

A similarity matrix is a matrix whose entries quantify pairwise similarity between objects, items, data points, or their representations.

How 3 Manning books explain it

Data Without Labels

An affinity matrix is a matrix whose entries quantify pairwise similarities or affinities between data points.

How it is used
Supports spectral clustering by encoding pairwise affinity for graph-based connectivity analysis.
How deep it goes
Defines similarity values and links them to spectral clustering, but stops short of detailing matrix construction algorithms.
Examples
Uses weighted graph diagrams, adjacency-matrix figures, complex cluster shapes, and an exercise deriving graph matrices.
What you can do after
Build an affinity representation from graph-based similarity weights and relate it to spectral clustering inputs.

Read how Data Without Labels explains similarity matrix →

Natural Language Processing in Action, Second Edition

A similarity matrix is a square matrix whose entries quantify pairwise similarity between objects.

How it is used
Computes pairwise relationships among sentence embeddings and supplies weights for graph-based connections.
How deep it goes
Defines dimensions, normalization, dot-product computation, symmetry, and graph conversion without developing matrix internals.
Examples
Uses chapter sentences, 300-dimensional embeddings, NumPy arrays, and a thresholded NetworkX graph.
What you can do after
Apply it via NumPy to calculate pairwise sentence similarity and derive weighted graph edges.

Read how Natural Language Processing in Action, Second Edition explains similarity matrix →

Graph Neural Networks in Action

A similarity matrix is a matrix whose entries quantify the similarity between pairs of items or representations.

How it is used
Builds product bundles by ranking items whose learned node embeddings are most similar.
How deep it goes
Explains matrix construction and nearest-item ranking, but defers the underlying cosine-similarity mathematics.
Examples
Uses Amazon product nodes and a Marceline vinyl figure to demonstrate six-item bundle generation.
What you can do after
Apply it via scikit-learn to rank products nearest to a chosen embedding.

Read how Graph Neural Networks in Action explains similarity matrix →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.