JY CHEN - Ask Anything, Learn Everything. Logo

In Computers and Technology / High School | 2025-07-08

Which algorithm predicts the surrounding words given a target word?

Asked by sjackson5481

Answer (1)

The algorithm that predicts the surrounding words given a target word is known as the 'Continuous Bag of Words' (CBOW) model.
What is CBOW? The Continuous Bag of Words is one of the two main architectures introduced in the Word2Vec algorithm by Tomas Mikolov and colleagues at Google in 2013. The objective is to predict a target word based on its context (surrounding words) in a given piece of text.
How does it work?

Input Layer: The model takes multiple context words as input. These words are typically presented as one-hot encoded vectors.

Hidden Layer: These input vectors are transformed into a continuous vector space. This hidden layer does not apply any activation function, allowing for the linear combination of the input vectors.

Output Layer: The output is a probability distribution over all words in the vocabulary, predicting the likelihood of each word being the center word given the context words provided as input.


Why is it important? CBOW is beneficial in natural language processing tasks like sentiment analysis, translation, and information retrieval because it captures the relationships between words in context. By understanding surrounding words, the model can generate word embeddings that are useful for various tasks, providing dense word representations.
Comparison with Skip-Gram: While CBOW predicts the target word from surrounding words, the Skip-Gram model does the reverse: it predicts surrounding words given a target word. Skip-Gram is generally more effective with smaller datasets, whereas CBOW performs better with larger ones.

Answered by AvaCharlotteMiller | 2025-07-21