# What are the main differences between skip-gram and continuous bag of words?

The skip-gram and continuous bag of words (CBOW) are two different types of word2vec model.

What are the main differences between them? What are the pros and cons of both methods?

So as you're probably already aware of, CBOW and Skip-gram are just mirrored versions of each other. CBOW is trained to predict a single word from a fixed window size of context words, whereas Skip-gram does the opposite, and tries to predict several context words from a single input word.

Intuitively, the first task is much simpler, this implies a much faster convergence for CBOW than for Skip-gram, in the original paper (link below) they wrote that CBOW took hours to train, Skip-gram 3 days.

For the same logic regarding the task difficulty, CBOW learn better syntactic relationships between words while Skip-gram is better in capturing better semantic relationships. In practice, this means that for the word 'cat' CBOW would retrive as closest vectors morphologically similar words like plurals, i.e. 'cats' while Skip-gram would consider morphologically different words (but semantically relevant) like 'dog' much closer to 'cat' in comparison.

A final consideration to make deals instead with the sensitivity to rare and frequent words. Because Skip-gram rely on single words input, it is less sensitive to overfit frequent words, because even if frequent words are presented more times that rare words during training, they still appear individually, while CBOW is prone to overfit frequent words because they appear several time along with the same context. This advantage over frequent words overfitting leads Skip-gram to be also more efficient in term of documents required to achieve good performances, much less than CBOW (and it's also the reason of the better performances of Skip-gram in capturing semantical relationships).

Anyway, you can find some comparisons in the original paper (section 4.3). Mikolov et al. 2013

About the architecture, there's not much to say. They just randomly initialised word embedding for each word, then a projection matrix NxD (number of context words times embeddings dimension) is generated at each iteration, there is no hidden layer, the vectors are just averaged together and then fed into an activation function to predict index probabilities in a vector of dimension V (the size of the vocabulary).

For a more specific explanation (even Mikolov's paper lack some detail) I suggest checking this blog page (Words as Vectors), even though the model described there do apply a hidden layer, unlike the original architecture.

Word embeddings are the results of learning from deep learning algorithms where computers can learn characters from data through feature extraction. One implementation of word embedding is word2vec.

Word2vec has two models namely Continous Bag of Word and Skip Gram Model. Both of these methods use the concept of a neural network that maps words to target variables which are also words. in this technique using "weight" as a word vector representation. CBOW, trying to predict a word on bases of its neighbors and Skip Gram, trying to predict the neighbors of a word.

In simpler words, CBOW tends to find the probability of a word occurring in a context. So it generalizes over all the different contexts in which a word can be used. Whereas SkipGram tends to study different context separately. Skip Gram needs more data to be trained contains more knowledge about the context.

for further explanation, you can read the paper from Mikolov about word embedding and word2vec. source: https://towardsdatascience.com/nlp-101-word2vec-skip-gram-and-cbow-93512ee24314$$`$$