liveBook · Manning

Similarity metric

A similarity measure is a rule that quantifies or characterizes how alike two objects or representations are according to selected properties.

How 10 Manning books explain it

Grokking Machine Learning

A numerical measure of the closeness between two data points.

How it is used
Defines similarity as a function used in the RBF kernel method to classify nonlinear datasets with SVMs.
How deep it goes
Defines closeness through distance, gives an exponential formula, and defers the full theory of kernels and feature maps.
Examples
Uses one- and two-dimensional labeled datasets, distance-based similarity values, and added similarity columns.
What you can do after
Apply similarity values as added features to classify nonlinear data with an SVM.

Read how Grokking Machine Learning explains similarity metric →

AI-Powered Search

A similarity metric is a numerical measure that quantifies how closely two representations or objects correspond.

How it is used
Ranks search candidates by measuring correspondence between queries, documents, phrases, or their vector representations.
How deep it goes
Explains vector construction, embedding comparison, cross-encoder scoring, reranking, and quadratic all-pairs cost without deriving metric mathematics.
Examples
Uses apple-juice document vectors, weather and vehicle phrases, and mountain-hike cross-encoder reranking.
What you can do after
Apply it via sentence-transformers to compare embeddings, sort similarity scores, and rerank search results.

Read how AI-Powered Search explains similarity metric →

Math and Architectures of Deep Learning

A measure of how alike two represented items are, especially when computed from their vector representations.

How it is used
Estimates similarity between vector representations for tasks such as document retrieval and ranked search.
How deep it goes
Explains dot-product geometry, angle dependence, document-vector construction, sparse storage, and worked comparisons.
Examples
Uses document descriptors, query ranking, word-frequency vectors, and d5–d6 versus d3–d4 dot-product comparisons.
What you can do after
Evaluate document relatedness and rank retrieval results by computing dot products between their feature vectors.

Read how Math and Architectures of Deep Learning explains similarity metric →

MongoDB 8.0 in Action, Third Edition

A similarity score is a numeric measure of how closely a query vector matches a document vector embedding.

How it is used
Configures vector indexes so semantic searches can rank documents by closeness to a query embedding.
How deep it goes
Defines cosine, Euclidean, and dot product behavior with application guidance, but does not develop mathematical derivations.
Examples
Uses movie-plot embeddings with cosine scoring and a local knnVector index using Euclidean similarity.
What you can do after
Apply it via Atlas CLI and vector search pipelines by selecting a metric, defining an index, and inspecting returned similarity scores.

Read how MongoDB 8.0 in Action, Third Edition explains similarity metric →

Get Programming: Learn to code with Python

Similarity is the degree to which two texts or other objects share comparable characteristics.

How it is used
Measures similarity between text files for document comparison, version checking, or essay-submission review.
How deep it goes
Explains a word-frequency formula, sanity checks, and modular implementation, while deferring more advanced language modeling to bigrams.
Examples
Uses identical files, an empty file, Shakespeare’s sonnets, and a three-word document modification as tests.
What you can do after
Apply via Python functions to read two files, count their words, and calculate a normalized similarity score.

Read how Get Programming: Learn to code with Python explains similarity metric →

Natural Language Processing in Action, Second Edition

Similarity is a numerical or qualitative measure of how closely two patterns or signals resemble each other.

How it is used
Ranks semantic-search results and checks whether compressed vector spaces preserve meaningful document relationships.
How deep it goes
Defines multiple distance families and applies cosine similarity, while noting that LSA preserves large but not always fine-grained distances.
Examples
Uses word-vector comparisons, semantic-search rankings, LSA-versus-TF-IDF checks, and scikit-learn’s catalog of pairwise metrics.
What you can do after
Apply it via gensim or vector-search tooling to compare terms, evaluate representations, and rank documents by relevance.

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

Data Without Labels

A similarity measure is a quantitative function that assesses how alike two data points, objects, or representations are.

How it is used
Measures likeness for clustering assignments and for preserving neighborhood relationships during dimensionality reduction.
How deep it goes
Defines distance-based similarity and several formulas, but defers centroid, norm, and probability-proof details.
Examples
Uses centroids, two-dimensional point coordinates, four distance paths, and Gaussian neighborhoods in t-SNE.
What you can do after
Evaluate/understand how distance choices alter similarity scores and clustering or embedding behavior.

Read how Data Without Labels explains similarity metric →

Machine Learning System Design

Vector similarity is a measure of how closely two numerical vectors correspond in direction, distance, or another defined geometric relationship.

How it is used
Drives photo search by matching user queries against searchable-item vectors.
How deep it goes
Separates vector generation and index querying, then specifies serving constraints without detailing the similarity calculation.
Examples
Uses daily index updates, on-demand reindexing, and peak query loads of roughly 100 requests per second.
What you can do after
Operate vector search by separating index updates from real-time queries and sizing each path for its workload.

Read how Machine Learning System Design explains similarity metric →

Transformers in Action

A similarity score is a numerical value indicating how closely two represented items align according to a specified similarity measure.

How it is used
Supports semantic search, retrieval-augmented generation, chatbot context resolution, and answer-quality estimation.
How deep it goes
Explains cosine scores, pairwise tensor shape, and directional interpretation, but defers the metric’s mathematical derivation.
Examples
Uses transformer-generated sentence embeddings, query-document pairs, cosine-similarity matrices, and a printed score tensor.
What you can do after
Apply cosine similarity through SentenceTransformer to rank documents against encoded queries.

Read how Transformers in Action explains similarity metric →

Bayesian Optimization in Action

A similarity metric is a numerical rule for quantifying how similar two data points are.

How it is used
Uses numerical similarity to define covariance and guide Gaussian-process predictions.
How deep it goes
Defines similarity through kernels, explains RBF behavior, and stops short of developing neural-network representations.
Examples
Uses house prices, door colors, living area, MNIST image tensors, heat maps, and an RBF length-scale implementation.
What you can do after
Evaluate whether a kernel's similarity notion matches the predictive features and structure of the data.

Read how Bayesian Optimization in Action explains similarity metric →

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.