Embedding

An embedding is a way of representing words, images, or other items as lists of numbers (vectors) so that similar items end up close together in that numeric space.

Data & AI

Computers can't work with raw words, so embeddings turn them into vectors that capture meaning. Words used in similar contexts get similar vectors — 'king' and 'queen' land near each other, and the model can even do arithmetic like king - man + woman is approximately queen.

Embeddings are central to modern NLP and search. By measuring the distance between vectors, systems can find related documents, recommend products, or power semantic search that matches meaning rather than exact words.

Examples

Python

import numpy as np
# Toy embeddings; similar words are closer
king  = [0.9, 0.8]
queen = [0.9, 0.7]
print("king-queen dist:",
      round(np.linalg.norm(np.subtract(king, queen)), 2))

Output:

king-queen dist: 0.1

Learn it in a lesson

See also

Back to the Dictionary