Contrastive learning
Contrastive learning is a representation-learning technique that trains a model to bring representations of related examples closer and separate representations of unrelated examples.
Build a Text-to-Image Generator (from Scratch)
Contrastive learning is a representation-learning technique that brings related examples closer and separates nonmatching examples in an embedding space.
- How it is used
- Uses shared embeddings to measure image–text similarity and support cross-modal retrieval.
- How deep it goes
- Explains encoders, batch similarities, and bidirectional losses, then stops short of deriving the loss equations.
- Examples
- Demonstrates Flickr 8k image–caption pairs, a beach-dog prompt, and batch diagonal versus off-diagonal similarities.
- What you can do after
- Apply it via CLIP to select images matching text descriptions and evaluate image–text compatibility.
Read how Build a Text-to-Image Generator (from Scratch) explains contrastive learning →
Outlier Detection in Python
A representation-learning technique that brings embeddings of similar items closer together and separates embeddings of dissimilar items.
- How it is used
- Uses learned embedding similarity as a self-supervised approach to tabular outlier detection.
- How deep it goes
- Defines the embedding objective and sketches ICL, but defers detailed implementation and training mechanics.
- Examples
- Uses altered images, tabular feature subsets, and KDD Cup records scored through DeepOD.
- What you can do after
- Apply it via DeepOD’s ICL estimator to fit tabular data and compute outlier scores.
Read how Outlier Detection in Python explains contrastive learning →
Related concepts
- CLIPused by · CLIP is a multimodal model and pretraining method that aligns image and text representations in a shared embedding space.
- multimodalused by · A multimodal model is a model that processes, generates, or relates information represented in two or more data modalities, such as text, images, audio, or video.
- self-supervised learninguses · Self-supervised learning is a machine-learning approach that derives training targets or supervisory signals from the data itself rather than relying on externally supplied labels.
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.

