liveBook · Manning

Vector arithmetic

As explained in Natural Language Processing in Action, Second Edition

Vector algebra is the system of addition, subtraction, scalar operations, and other mathematical operations on vectors.

Vector arithmetic applies addition, subtraction, and related operations to word embeddings. In Word2Vec, these operations turn relationships between words into geometric displacements. section 6.3.1

A typical analogy calculation works like this:

  • Subtract the vector for one city from its associated sports team. section 6.3.1
  • Add that displacement to another city’s vector. section 6.3.1
  • Find the vocabulary vector closest to the resulting point, since the exact result usually is not itself a word vector. section 6.3.1

Sports-team analogy

Portland Timbers + Seattle − Portland ≈ Seattle Sounders. The calculation transfers the city-to-team relationship through embedding space, supporting analogy questions in search, chatbots, and question-answering systems. section 6.3.1

Portland Timbers + Seattle - Portland = ?

Inspect the compact analogy expression behind the worked vector calculation. section 6.3.1

How Natural Language Processing in Action, Second Edition covers it

How deep it goes
Explains addition, subtraction, displacement, and nearest-vector lookup, stopping short of implementation details.
Examples
Uses the Portland Timbers plus Seattle minus Portland analogy and geometric word-vector visualizations.
What you can do after
Apply it via Word2Vec to transform word relationships into analogy answers.
How it connects
Connects vector arithmetic with word embeddings, Word2Vec, analogy reasoning, and question-answering systems.

Also explained in

Compare how 2 books explain vector arithmetic →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Natural Language Processing in Action, Second Edition. The section links point to the parts of the book it draws on.