The skip-gram word2vec model

The skip-gram model is trained to predict the surrounding words given the current word. To understand how the skip-gram word2vec model works, consider the following example sentence:

I love green eggs and ham.

Assuming a window size of three, this sentence can be broken down into the following sets of (context, word) pairs:

([I, green], love) ([love, eggs], green) ([green, and], eggs) ...

Since the skip-gram model predicts a context word given the center word, we can convert the preceding dataset to one of (input, output) pairs. That is, given an input word, we expect the skip-gram model to predict the output word:

(love, I), (love, green), (green, love), (green, eggs), (eggs, green), (eggs, and), ...

We can also ...

Get Deep Learning with Keras 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.