Views
No views yet
1## create a virtual environment
2python -m venv venv
3## activate the venv
4source ./venv/bin/activate # Windows: ./venv/Scripts/activate
5
6pip install -r requirements.txt
7
8***How it Works***
9## Loads a small dataset of sentences.
10## Generates embeddings with all-MiniLM-L6-v2.
11## Reduces dimensions using PCA and t-SNE.
12## Visualizes them on a 2D plot.
13
14
15## Example Output
16
17When running the script, you will see:
18followed by **two interactive plots**:
19
201. **PCA Visualization**
21 - Each dot represents a sentence.
22 - Sentences with similar meaning appear closer together.
23 - Example:
24 - "The Eiffel Tower is in France"
25 and "The capital of France is Paris"
26 are positioned near each other.
27
282. **t-SNE Visualization**
29 - Another dimensionality reduction method that shows natural clusters.
30 - Example:
31 - "Cats are amazing pets" and "Dogs are loyal companions"
32 appear together in one cluster, away from unrelated topics.
33
34The plots help you **see how AI models understand meaning** in text.
35
36---
37
38## Sample Sentences Used
39- Artificial intelligence is transforming the world.
40- Cats are amazing pets.
41- The capital of France is Paris.
42- The Eiffel Tower is in France.
43- Deep learning enables image recognition.
44- Dogs are loyal companions.
45- The sun rises in the east.
46- The moon orbits the Earth.