Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Natural Language Processing with TensorFlow - Second Edition

You're reading from  Natural Language Processing with TensorFlow - Second Edition

Product type Book
Published in Jul 2022
Publisher Packt
ISBN-13 9781838641351
Pages 514 pages
Edition 2nd Edition
Languages
Author (1):
Thushan Ganegedara Thushan Ganegedara
Profile icon Thushan Ganegedara

Table of Contents (15) Chapters

Preface 1. Introduction to Natural Language Processing 2. Understanding TensorFlow 2 3. Word2vec – Learning Word Embeddings 4. Advanced Word Vector Algorithms 5. Sentence Classification with Convolutional Neural Networks 6. Recurrent Neural Networks 7. Understanding Long Short-Term Memory Networks 8. Applications of LSTM – Generating Text 9. Sequence-to-Sequence Learning – Neural Machine Translation 10. Transformers 11. Image Captioning with Transformers 12. Other Books You May Enjoy
13. Index
Appendix A: Mathematical Foundations and Advanced TensorFlow

The Continuous Bag-of-Words algorithm

The CBOW model works in a similar way to the skip-gram algorithm, with one significant change in the problem formulation. In the skip-gram model, we predict the context words from the target word. However, in the CBOW model, we predict the target word from contextual words. Let’s compare what data looks like for the skip-gram algorithm and the CBOW model by taking the previous example sentence:

The dog barked at the mailman.

For the skip-gram algorithm, the data tuples—(input word, output word)—might look like this:

(dog, the), (dog, barked), (barked, dog), and so on

For CBOW, the data tuples would look like the following:

([the, barked], dog), ([dog, at], barked), and so on

Consequently, the input of the CBOW has a dimensionality of 2 × m × D, where m is the context window size and D is the dimensionality of the embeddings. The conceptual model of CBOW is shown in Figure 3.13:

C:\Users\gauravg\Desktop\14070\CH03\B08681_03_29.png

Figure...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}