Vectors & Cosine Similarity Using 3D Visualization
How Are Words Converted into Vectors?
Words are converted into vectors by analyzing their contexts in large amounts of text and adjusting numeric representations so that similar words end up with similar vectors. A typical pipeline looks like this:
Phase 1: Characters → Numbers: Convert each character (e.g., ‘a’, ‘b’) to numeric codes (ASCII, Unicode, etc.).
Phase 2: Numbers → Normalized Values: Clean or transform these numbers - lowercase
them, remove punctuation, or assign unique IDs.
Phase 3: Values → Vector Components: Use these IDs in an embedding model (like
Word2Vec) to learn vector coordinates.
Phase 4: Final Vector: Combine these coordinates into a single vector that captures each word’s meaning.
What Is Cosine Similarity?
Cosine similarity measures how close two vectors are by taking the cosine of the angle between them. If the angle is small, the cosine is close to 1, indicating the vectors and thus the words or concepts are highly similar.
What Is the Role of Vectors in Measuring Similarity Score?
Vectors let us compare words (or any data) numerically. Once you have vectors, you can calculate distances or angles (like cosine similarity) to quantify how “close” or “far apart” different words or ideas are in that high-dimensional space.
In a 3D visualization, you can imagine each word as a point in 3D space. Words that often appear in similar contexts cluster together, while unrelated words sit farther apart. Though real embedding spaces typically have dozens or hundreds of dimensions, the 3D analogy helps us visualize how vectors capture meaning.
#ai
#vectors
#cosinesimilarity
