# Day 8 - Jan 31 2026

Understand how computers "understand" the relationship between words using Vector Embeddings.

### 1. What is an Embedding?

Computers cannot read text; they only read numbers. An Embedding is a translation of a word (or sentence) into a long list of numbers, called a Vector.

* The Analogy: Think of a grocery store.
  * "Apple" is at coordinates \[Aisle 1, Shelf 5].
  * "Banana" is at \[Aisle 1, Shelf 6].
  * "Shampoo" is at \[Aisle 9, Shelf 2].
  * Mathematically, Apple is "closer" to Banana than to Shampoo. Embeddings do this for *concepts*.

### 2. Why "Keyword Search" is Dead

Traditional search (Ctrl+F) looks for exact matches.

* *Query:* "Canines"
* *Document:* "Dogs are loyal."
* *Result:* 0 matches. (Bad user experience).

Semantic Search (Embeddings):

* *Query:* "Canines" → Vector A
* *Document:* "Dogs are loyal" → Vector B
* *Result:* Vector A and Vector B are mathematically close. The AI finds the document even though the words are different.

### 3. Cosine Similarity (The Math)

How do we measure if two vectors are close? We measure the angle between them.

* Cosine Similarity = 1.0: The vectors point in the exact same direction (Identical meaning).
* Cosine Similarity = 0.0: The vectors are 90° apart (Unrelated).
* Cosine Similarity = -1.0: Opposite meaning.

This is the foundation of RAG (Retrieval Augmented Generation), which I will build over the next few days.

### Status:

* [x] Installed NumPy & Scikit-learn
* [x] Generated Vectors using Llama 3.2
* [x] Calculated Semantic Distance successfully


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://shankar-lab.gitbook.io/mylearning/15-days-genai-learning-challenge/day-8-jan-31-2026.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
