Working with CBOW Embeddings
In this recipe we will implement the CBOW method of word2vec. It is very similar to the skip-gram method, except we are predicting a single target word from a surrounding window of context words.
Getting ready
In this recipe, we will implement the CBOW method of Word2vec. It is very similar to the skip-gram method, except we are predicting a single target word from a surrounding window of context words.
In the prior example, we treated each combination of window and target as a group of paired inputs and outputs, but with CBOW we will add the surrounding window embeddings together to get one embedding to predict the target word embedding:
Get TensorFlow Machine Learning Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.