Loading...
Solve word analogies using vector arithmetic on word embeddings.
Word analogies take the form: "A is to B as C is to ?"
Using word vectors, the answer is the word whose vector is closest to: B−A+C
Input format:
Output: The word from the vocabulary (excluding A, B, C) whose vector is closest to B - A + C (using cosine similarity).
king queen man 5 king 1.0 0.5 0.0 queen 0.8 0.6 0.5 man 0.9 0.4 0.0 woman 0.7 0.5 0.5 child 0.2 0.3 0.8
woman
Step 1: Compute target vector target = queen - king + man = [0.8, 0.6, 0.5] - [1.0, 0.5, 0.0] + [0.9, 0.4, 0.0] = [0.7, 0.5, 0.5]
Step 2: Compute cosine similarity with each candidate Candidates (excluding king, queen, man): woman, child
Answer: woman (highest similarity)