0% found this document useful (0 votes)
2 views7 pages

Program2 Lab

Uploaded by

Shreyas R
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views7 pages

Program2 Lab

Uploaded by

Shreyas R
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Program: 2

Use dimensionality reduction (e.g., PCA or t-SNE) to visualize word embeddings for Q 1. a
specific domain (e.g., sports, technology) and visualize their embeddings. Analyze clusters
and relationships. Generate contextually rich outputs using embeddings. Write a program to
generate 5 semantically Select 10 words from similar words for a given input.

Title
Exploring Word Relationships and Visualizing Word Embeddings using Word2Vec
Aim
To perform word analogy operations using Word2Vec and visualize semantic relationships using
PCA and t-SNE techniques.
Software Requirements
 Python 3.x
 Gensim
 NumPy
 Matplotlib
 Scikit-learn

Theory

Word2Vec is a neural network-based model that converts words into dense vector
representations. Semantic relationships between words can be discovered using vector
arithmetic. Dimensionality reduction techniques such as PCA and t-SNE help visualize high-
dimensional embeddings in 2D space.

Algorithm
 Import required libraries.
 Load pre-trained Word2Vec model.
 Accept three words as input.
 Perform vector arithmetic:
word1 − word2 + word3
 Find most similar words using cosine similarity.
 Remove input words from results.
 Collect word vectors for visualization.
 Reduce dimensions using PCA and t-SNE.
 Plot words on a 2D graph.

Source Code:
Continue….
Continue……
Continue….
Output:

Continue….
Continue….
Viva Questions
1. What is Word2Vec?
2. Difference between CBOW and Skip-Gram?
3. Why is dimensionality reduction required?
4. Difference between PCA and t-SNE?
5. What similarity measure is used in Word2Vec?
Result
The semantic relationship between words was successfully identified using Word2Vec. PCA and
t-SNE visualizations clearly demonstrate meaningful word clusters.
Applications
 Natural Language Processing
 Information Retrieval
 Recommendation Systems
 Chatbots and Virtual Assistants

You might also like