Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

skip gram

How to predict a word using Word2Vec model?

Shahroz Ajmal


Text prediction is a significant part of Machine Learning, which can be done by converting text to numerical values and training our model after feeding these values. The Word Embedding technique is used to convert words to vectors of integers. For instance, the term "EdTechEducative" can be described by a numerical value of 249.

The basis of the Word2Vec technique is to give words a proper context with semantic meanings similar to each other. Semantically identical words are arranged closely in the vector space to represent words as vectors. The architecture of Word2Vec is as follows:

Word2Vec model architechture

TensorFlow library is used to implement Word2Vec. It’s a 3-layered neural network with a hidden layer.

Note: We use logistic regression for training.


The goal is to define terms with similar semantic properties uniformly word2vec has two methodologies:

Types of Word2Vec and its application

1. Continuous Bag-of-Words model (CBOW)

This method uses the context to guess the target word. Therefore, the context is used to make a word. This model works efficiently for the smaller dataset.

2. Skip-gram model

This methods predicts the context of the target words. Each context is a new observational pair for the specific target. The Skip-gram approach is best suited for more extensive datasets.

CBOW vs Skip-gram

The training time of CBOW is lesser than Skip-gram. CBOW outperforms and provides more accurate results when redundant data occurs.

Note: Words are often converted to vectors using the One hot encoding technique.


skip gram

View all Courses

Keep Exploring